Jump to content

Polyline with Global Width


Guest

Recommended Posts

Hi , I am trying to write a lisp to draw a polyline in specific layer with Global width 0.10

 

here is the code

 

(defun C:PLGB (/ plw)
(COMMAND "_layer" "_m" "Global PL" "_c" "25" "DASHED2" "_lt" "DASHED2" "DASHED2" "")
(COMMAND "_linetype" "_s" "DASHED2" "")
(setq plw (getvar 'plinewid)
(setvar 'plinewid 0.10)
(command "_.pline")
(setvar 'plinewid plw)
)
); defun

 

This code gives me this message

 

; error: syntax error

 

Can any one help me ? :P

 

Thanks

Link to comment
Share on other sites

(defun C:PLGB (/ plw)
(COMMAND "_layer" "_m" "Global PL" "_c" "25" "DASHED2" "_lt" "DASHED2" "DASHED2" "")
(COMMAND "_linetype" "_s" "DASHED2" "")
(setq plw (getvar 'plinewid)[color="red"][b]) [/b]; missing parentheless?[/color]
(setvar 'plinewid 0.10)
(command "_.pline")
(setvar 'plinewid plw)
[color="red"] <--- remove this[/color]
); defun

Link to comment
Share on other sites

thank you for the reply hanhphuc

 

I do the changes but i can not see the global width 0.50 . It still 0 ?

 

(defun C:PLGB (/ plw)
(COMMAND "_layer" "_m" "Global PL" "_c" "25" "DASHED2" "_lt" "DASHED2" "DASHED2" "")
(COMMAND "_linetype" "_s" "DASHED2" "")
(setq plw (getvar 'plinewid)) 
(setvar 'plinewid 0.50)
(command "_.pline")
(setvar 'plinewid plw)
); defun

 

 

I want to add

 

global width 0.50

line type scale 0.10

 

The collor of the layer is white and not 25 (i don't now why ? )

Link to comment
Share on other sites

Try the following:

(defun c:plgb ( / lay val var )
   (setq var '(clayer plinewid cmdecho celtscale cecolor celtype)
         val  (mapcar 'getvar var)
         lay  "Global PL"
   )
   (mapcar 'setvar (cdr var) '(0.5 0 0.1 "bylayer" "bylayer"))
   (command "_.-layer" "_m" lay "_c" 25 lay "_l" "dashed2" lay "_t" lay "_u" lay "_on" lay "_s" lay "")
   (setvar 'cmdecho 1)
   (command "_.pline")
   (while (= 1 (logand 1 (getvar 'cmdactive))) (vl-cmdf "\\"))
   (mapcar 'setvar var val)
   (princ)
)

Link to comment
Share on other sites

Hi Lee Mac . I try your code but the results is not exactly what i want.

 

I want to create a layer with name "Global PL" and color 25 with line type "dashed2" but

a) in the line type Manager I want global scale factor 1 ,current object scale 1

b)When i select the polyline --> have global width 0.50

 

Look the attach photo

 

Thanks

2.jpg

1.jpg

Link to comment
Share on other sites

I try to understand something

 

in 1.dwg file lisp works perfect.

in 2.dwg file the polyline have the same settings with 1.dwg but is not the same !!!!

 

I can not understand

 

(defun c:plgb  ( / lay val var )
   (setq var '(clayer plinewid cmdecho celtscale cecolor celtype)
         val  (mapcar 'getvar var)
         lay  "Global PL"
   )
   (mapcar 'setvar (cdr var) '(0.5 0 0.1 "bylayer" "bylayer"))
   (command "_.-layer" "_m" lay "_c" 25 lay "_l" "DASHED2" lay "_t" lay "_u" lay "_on" lay "_s" lay "")
   (setvar 'cmdecho 1)
   (command "_.pline")
   (while (= 1 (logand 1 (getvar 'cmdactive))) (vl-cmdf "\\"))
   (mapcar 'setvar var val)
   (princ)
(setvar 'CELTYPE old_clt) [color="red"]; I add this line to the code and now global scale factor 1 ,current object scale 1[/color]
)

 

Thanks

1.dwg

2.dwg

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