I'm trying to create a script to tidy up drawings

I'm trying to create a script to tidy up drawings

Mike_Steel
Contributor Contributor
580 Views
5 Replies
Message 1 of 6

I'm trying to create a script to tidy up drawings

Mike_Steel
Contributor
Contributor

Can someone help me with a script to set drawing/s properties to please.

I cant seem to find help with syntax and or instruction conventions.

That's not to say that I have looked in the right place 🙂

 

Color = bylayer

Current Layer = 0

Linetype = bylayer

Linetype scale = 1

Lineweight = bylayer

Transparency = bylayer

Thickness = 0

 

Mike_Steel_0-1714430077834.png

 

 

 

0 Likes
Accepted solutions (2)
581 Views
5 Replies
Replies (5)
Message 2 of 6

vladop
Collaborator
Collaborator
Accepted solution

Тhis lisp should set defaults in all drawings of the active project:

 

(defun C:SetDefaults ()
  (mapcar
    '(lambda (x)
       (wd_dbx_command (setq fhdl (wd_dbx_open x "w")) "LAYER" "SET" "0" "" "")
       (wd_dbx_setvar fhdl "CECOLOR" "BYLAYER")
       (wd_dbx_setvar fhdl "CELTYPE" "BYLAYER")
       (wd_dbx_setvar fhdl "CELTSCALE" 1.0000)
       (wd_dbx_setvar fhdl "CELWEIGHT" -1)
       (wd_dbx_setvar fhdl "CETRANSPARENCY" "BYLAYER")
       (wd_dbx_setvar fhdl "THICKNESS" 0)
       (wd_dbx_close fhdl T))
    (nth 2 (c:ace_proj_data nil))))
 
Regards,
Vladimir
Message 3 of 6

Mike_Steel
Contributor
Contributor

thanks vladop - I'm hoping to use a script then I can use / Project / Utilities / .. to manage which Drawings I apply it to.

This is as far as I have got with it.

 

(command "_.COLOR"
"BYLAYER"
)
(command "_.LINETYPE"
"_set" "BYLAYER"
""
)
(command "_.LWEIGHT"
"BYLAYER"
)
(command "_.layer"
"_set" "0"
""
)

 

 

0 Likes
Message 4 of 6

vladop
Collaborator
Collaborator

If you want to select drawings:

 

(defun C:SetDefaults ()
(mapcar
'(lambda (x)
(wd_dbx_command (setq fhdl (wd_dbx_open x "w")) "LAYER" "SET" "0" "" "")
(wd_dbx_setvar fhdl "CECOLOR" "BYLAYER")
(wd_dbx_setvar fhdl "CELTYPE" "BYLAYER")
(wd_dbx_setvar fhdl "CELTSCALE" 1.0000)
(wd_dbx_setvar fhdl "CELWEIGHT" -1)
(wd_dbx_setvar fhdl "CETRANSPARENCY" "BYLAYER")
(wd_dbx_setvar fhdl "THICKNESS" 0)
(wd_dbx_close fhdl T))
(car (c:wd_pdwgs (nth 6 (c:wd_proj_wdp_data)) "Select files" "Default settings" nil))))

0 Likes
Message 5 of 6

Mike_Steel
Contributor
Contributor
Accepted solution

Awesome Thanks Vladimir  👍👍👍

0 Likes
Message 6 of 6

vladop
Collaborator
Collaborator

You're Welcome

0 Likes