Jump to content

Simil-hatch between two polilines made by perpendiculars


whilin

Recommended Posts

I am trying to writing a small lisp to do following thing between two polylines:

 

i6rx.png

It must:

select first polyline

divide it in n parts -> get computed points.

From each point, draw a segments perpendicular to the first polyline that stops at the second polyline.

Every two segments, break the drawn segment in two parts and delete one part.

I don't know how to start writing my lisp :unsure:

 

Thank you a lot. :)

Link to comment
Share on other sites

I FOUND this autolisp but it doesn't work in AUTOCAD 2014:

(defun C:PLWEB ()
 (command "_.undo" "_begin")
 (setq
   poly1 (car (entsel "\nSelect first Polyline: "))
   poly2 (car (entsel "\nSelect second Polyline: "))
   segs (getint "\nDivide first Polyline into how many segments? ")
   seglen ; length of segment along 1st Pline
     (/
       (vlax-curve-getDistAtParam
         poly1
         (vlax-curve-getEndParam poly1)
       ); end getDist
       segs
     ); end getDist and length1
   inc 0
   osm (getvar 'osmode)
 ); end setq
 (setvar 'osmode 0)
 (repeat (1+ segs)
   (command
     "_.line"
     (vlax-curve-getPointAtDist
       poly1
       (* seglen inc); position along 1st Pline
     ); end getPoint
     "per"
     (vlax-curve-getClosestPointTo
       poly2
       (getvar 'lastpoint)
     ); end getClosest
     "" ; end line
   ); end command
   (setq inc (1+ inc))
 ); end repeat
 (setvar 'osmode osm)
 (command "_.undo" "_end")
); end defun

This is the error:

Specify first point:
Specify next point or [undo]: per to
No Endpoint found for specified point.
Point or option keyword required.
; error: Function cancelled
Specify next point or [undo]:

Hope it helps. Thank you again :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...