Jump to content

The function to create of polyline


jan_ek

Recommended Posts

Have anyone tried to create a command which draws a polyline according to coordinates of points and the radius of bending? It means that the command draws, for example, a polyline like in attachment, arguments are points marked on yellow and diameter of arch (for example), alternatively there could be also a commend closing polyline.

I have read about the way of counting a radius according to "bulge". I am not sure how I should start - what should be counted into a radius?

I would be very grateful for any help or comments.

01.jpg

Link to comment
Share on other sites

Well, if you have all dimensions set, then correct array of dimensions is required in order to get correct array of points - future vertices, and for arced segments I suggest that you use fillet command - it's also required correct array of selected dimensions... But all in all, I would draw that pline manually faster than with possible quirkiness ab obtain correct arrays from sel. sets...

Link to comment
Share on other sites

try this

(defun c:test ()
 (entmake '((0 . "LWPOLYLINE")
        (100 . "AcDbEntity")
        (8 . "0")
        (100 . "AcDbPolyline")
        (90 . ;Number of vertices
        (10 176.0636632716071 279.6390112374238); 10 =Vertex coordinates (in OCS), multiple entries; one entry for each vertex
        (10 346.0636632716071 279.6390112374238)
        (42 . 0.414213562373095); 42=Bulge (multiple entries; one entry for each vertex) (optional; default = 0)
        (10 376.0636632716071 309.6390112374238)
        (10 376.0636632716071 449.6390112374237)
        (42 . -0.414213562373095)
        (10 406.0636632716071 479.6390112374238)
        (10 568.0354241512509 479.6390112374238)
        (42 . 0.131490546050545) 
        (10 583.0188770098191 483.6487026506627)
        (10 821.2389076067196 620.9829165365836)
        (70 . 0);Polyline flag (bit-coded); default is 0: 1 = Closed;
       )
 )
 (princ)
)                    

HTH

m.badran

Link to comment
Share on other sites

A slight variation on above the point list could come from somewhere else execl etc.

 

(defun make_sq ()
(setq vertexList (list 
(list -3.25 -3.25 0.)
(list 3.25 -3.25 0.)
(list 3.25 3.25 0.)
(list -3.25 3.25 0.)
))
(entmakex
(append 
(list '(0 . "LWPOLYLINE") 
'(100 . "AcDbEntity")
'(100 . "AcDbPolyline")
(cons 90 (length vertexList))
(cons 70 1)  ; 1 closed : 0 open
(cons 8 "0")
(cons 38 0.0)
(cons 210 (list 0.0 0.0 1.0))
)
(mapcar '(lambda (pt) (cons 10 pt)) vertexList)
)
)
)

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...