Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Automate All to Zero and With Existing Entity Properties: How-to Needed
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Automate All to Zero and With Existing Entity Properties: How-to Needed (Read 336 times)
0 Members and 1 Guest are viewing this topic.
chilldaddy
Guest
Automate All to Zero and With Existing Entity Properties: How-to Needed
«
on:
March 19, 2024, 09:38:01 AM »
Goal:
Find methods to help assemble a new LISP program or find an existing LISP program to perform the following:
Convert all entities to layer zero while maintaining properties as originally assigned based on the entities' original layer.
In a single DWG file, 700+/- details are organized and include drawing borders that supply individual details to our main non-Autodesk specialized and multi-functional design application.
Please provide:
Links to and/or actual LISP programs that perform this or similar conversions.
LISP tips and/or instruction on links to methods to create a conversion LISP program.
Non-programmed methods to accomplish this conversion.
Skill level:
Almost a
LISP Beginner
Logged
ribarm
Gator
Posts: 3310
Marko Ribar, architect
WWW
Re: Automate All to Zero and With Existing Entity Properties: How-to Needed
«
Reply #1 on:
March 19, 2024, 10:05:00 AM »
If you have Autocad 2007+, then this should work, since "copytolayer" command was introduced at that release...
Code - Auto/Visual Lisp:
[Select]
(
defun
c:moveto0layer
(
/
ss
)
(
prompt
"
\n
Select objects to move to 0 Layer..."
)
(
if
(
setq
ss
(
ssget
"_:L"
)
)
(
progn
(
if
command
-
s
(
command
-
s
"_.-copytolayer"
ss
""
"0"
""
)
(
vl-cmdf
"_.-copytolayer"
ss
""
"0"
""
)
)
(
if
command
-
s
(
command
-
s
"_.erase"
ss
""
)
(
vl-cmdf
"_.erase"
ss
""
)
)
;;; if you want to keep source layer(s) don't remove ;| and |; , but if you want them purged - erased, remove ;| and |; ...
;|
(if command-s
(command-s "_.-purge" "_la" "*" "_n")
(vl-cmdf "_.-purge" "_la" "*" "_n")
)
|;
)
)
(
princ
)
)
M.R.
Logged
Marko Ribar, d.i.a.
(graduated engineer of architecture)
M.R. on Youtube
ribarm
Gator
Posts: 3310
Marko Ribar, architect
WWW
Re: Automate All to Zero and With Existing Entity Properties: How-to Needed
«
Reply #2 on:
March 19, 2024, 11:56:33 AM »
Another one in pure AutoLISP...
Code - Auto/Visual Lisp:
[Select]
(
defun
c:moveto0layer
(
/
ss i e ex
)
(
prompt
"
\n
Select objects to move to 0 Layer..."
)
(
if
(
setq
ss
(
ssget
"_:L"
)
)
(
repeat
(
setq
i
(
sslength
ss
)
)
(
setq
e
(
ssname
ss
(
setq
i
(
1-
i
)
)
)
)
(
setq
ex
(
entget
e
)
)
(
entupd
(
cdr
(
assoc
-
1
(
entmod
(
subst
(
cons
8
"0"
)
(
assoc
8
ex
)
ex
)
)
)
)
)
)
)
(
princ
)
)
Logged
Marko Ribar, d.i.a.
(graduated engineer of architecture)
M.R. on Youtube
chilldaddy
Guest
Re: Automate All to Zero and With Existing Entity Properties: How-to Needed
«
Reply #3 on:
March 19, 2024, 12:13:56 PM »
Ah yes, "ribarm"!
We run the latest version. Both of your generous contributions and the descriptions provided are very helpful and educated me, saving my company tons of processing time and expense.
Thanks a million!
Logged
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Automate All to Zero and With Existing Entity Properties: How-to Needed