Jump to content

Recommended Posts

Posted (edited)

hello, an existing lisp is not doing enough for me. For example, I can't make arc and circle or more amorphous lines, because they make straight polylines. I struggle with setting the thickness I want each time. what I have in mind is to convert a polyline line I want to the thickness I want. Could you help?

 

(defun c:1mm_pline ( / oldlt)
  (setq oldlt (getvar 'celtype))
    (command "layer" "s" "Layer1" "")
    (setvar 'celtype "hidden")
    (setvar 'CELTSCALE 1)
    (setvar 'plinewid 0.7)
    (setq pt (getpoint "\nPline start point: "))
    (command "_pline" pt)
    (while (= (getvar "cmdactive") 1 )
    (command (getpoint (getvar 'lastpoint)))
    )
(if (= (getvar "cmdactive")0)
  (progn
    (setq plent (vlax-ename->vla-object (entlast)))
    (if (vlax-method-applicable-p plent 'offset)
      (progn
(vla-offset plent 0.5)
 (setq en1 (vlax-ename->vla-object (entlast)))
(vla-put-Constantwidth en1 0)
(vla-put-linetypescale en1 1)
(vla-put-linetype en1 "Continuous")
(vla-offset plent -0.5)
(setq en2 (vlax-ename->vla-object (entlast)))
(vla-put-Constantwidth en2 0)
(vla-put-linetypescale en2 1)
(vla-put-linetype en2 "Continuous")))))
(setvar 'celtype oldlt)
(setvar 'CELTSCALE 1)
(setvar 'plinewid 0.0)
(princ )
)

 

Edited by SLW210
Please use Code Tags!!
Posted

Your code will only run if Layer1 is in the drawing and is limited like you said.

I'd recommend modifying this similar lisp that converts a polyline to a wide dashed polyline with two solid polylines offset to each side like Railroad tracks were often displayed on old drawings. Got it from the old T-Square Graphics site 1998-2002 which isn't there anymore. 

Give it a try.

rrl.lsp

Posted
10 hours ago, pegasus said:

what I have in mind is to convert a polyline line I want to the thickness I want.

 

@pegasus do you mean some like it?

image.png.b4b304361ca0f9a4353afa5f8e4321cf.png

I made it by given Arc and Line options when PLINE 

(defun c:1mm_pline ( / oldlt)
  (setq oldlt (getvar 'celtype))
    (command "layer" "m" "Layer1" ""); the M option make or set the layer
    (setvar 'celtype "hidden"); it has to be loaded 
  
    (setvar 'CELTSCALE 1)
    (setvar 'plinewid 0.7)
    (setq pt (getpoint "\nPline start point: "))
    (command "_pline" pt)
    (while (= (getvar "cmdactive") 1 )
    (command (getpoint (getvar 'lastpoint)))
    )
(if (= (getvar "cmdactive")0)
  (progn
    (setq plent (vlax-ename->vla-object (entlast))))
    (if (vlax-method-applicable-p plent 'offset)
      (progn
(vla-offset plent 0.5)
 (setq en1 (vlax-ename->vla-object (entlast)))
(vla-put-Constantwidth en1 0)
(vla-put-linetypescale en1 1)
(vla-put-linetype en1 "Continuous")
(vla-offset plent -0.5)
(setq en2 (vlax-ename->vla-object (entlast)))
(vla-put-Constantwidth en2 0)
(vla-put-linetypescale en2 1)
(vla-put-linetype en2 "Continuous")
)
      )
    )
  )
(setvar 'celtype oldlt)
(setvar 'CELTSCALE 1)
(setvar 'plinewid 0.0)
(princ )
)

 

3 lines poly.dwg like tracks.lsp

  • Like 1
Posted
8 hours ago, tombu said:

Give it a try.

Seem to be RAILROAD is not at ACAD.lin , on new versions , TRACKS could be used 

 

  • Like 1
Posted (edited)

Please WIDTH, thickness is something altogether different in Autocad.

 

What is problem with draw 1 pline then offset twice and change original pline width and linetype  ? I would use like a custom linetype like one I have "equal" which is a equal draw solid and gap. Change LTSCALE and lengthens or shortens central pline dashed pline.

 

Should add if common sizes then just type a size eg 300 then all values are known +- 150 and width = 270.

Edited by BIGAL
  • Like 1

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