TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: ELOQUINTET on February 01, 2008, 02:26:38 PM
-
i'm trying to write a house cleaning script and cannot get a couple of things to work.
1) i am trying to set the layer 0 so i can purge out all unwanted layers.
I am using 2 methods layer set and clayer and neither one is changing the layer
Any thoughts as to why not?
-layer
set
0
clayer
0
2)
Iam also trying to set the current dimstyle to STANDARD for the same purposes but the dialogue box is halting the script not allowing me to purge, any thoughts?
-dimstyle
restore
STANDARD
-
(command ".-layer" "s" "0") or (setvar 'clayer 0) for starters.
-
this is from my text window?
Command: (command ".-layer" "s" "0")
.-layer
Current layer: "_REVCLOUD070831"
Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
s
Enter layer name to make current or <select object>: 0 Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
nil
Command: (setvar "clayer" 0)
; error: AutoCAD variable setting rejected: "clayer" 0
-
try taking the quotes off "0"? I know 2008 made some commands a little goofy. Don't have it here, so I can't dig deeper for you.
-
i figured out what was causing the layer to not change. I disabled this reactor that we were working on in this post :roll:
http://www.theswamp.org/index.php?topic=21056.0 (http://www.theswamp.org/index.php?topic=21056.0)
-
daron i'm actually now using adt 3.3 which i just changed in my profile :cry: but we will be upgrading to 2007 soon, Real soon I hope...
-
They should just wait 'til March and upgrade to '09 or at least go to '08. Wait? Why are you using ADT for Ralph Lauren? You drawing their buildings?
-
daron i got the stuff i was asking about working but now i have another problem. i am trying to select all of the hatch, dimensions, leaders text and delete it. It is working if all exists in the drawing but if not then it halts. I'm guessing I need to wrap all of this inside of an if statement but not sure how. I'm also guessing these could all be combined but not sure how that should look. To answer your autocad questions. They won't upgrade to those versions because it has not had time to be "engineered" by out IT department. We are using adt but I guess they stripped away that functionality cause i don't see any of it on my screen. I think we will be switching to straight acad 07.
(setq d (ssget "x" '((0 . "hatch"))))
erase
!d
;select all notation and erase it
(setq d (ssget "x" '((0 . "dimension"))))
erase
!d
(setq d (ssget "x" '((0 . "leader"))))
erase
!d
(setq d (ssget "x" '((0 . "mtext"))))
erase
!d
(setq d (ssget "x" '((0 . "text"))))
erase
!d
-
I don't want to lead you down the wrong path by not testing this idea, but I believe you can do an "or" statement. Look >>here<< (http://www.theswamp.org/index.php?topic=20300.0) for how to lump it all into one call. Hint: replace NOT with OR
-
(if (setq d (ssget "x" '((0 . "TEXT,MTEXT,LEADER,DIMENSION,HATCH"))))
(command "._erase" d "")
)
(defun c:deletelayouts (/)
(vlax-map-collection
(vla-get-layouts
(vla-get-ActiveDocument
(vlax-get-Acad-Object)
)
)
'(lambda (x)
(vl-catch-all-apply 'vla-delete (list x))
)
)
(princ)
)
-
i was trying this method daron but couldn't get it working, here's what i had.
i am using rons' but would still like to know the other way.
i have another question also. i need to delete all of the layouts in the drawing but don't see how i could do that throught a macro without speciying the name which may vary.
(ssget (list '(-4 . "<OR")
'(0 . "hatch")
'(0 . "dimension")
'(0 . "leader")
'(0 . "mtext")
'(0 . "text")
'(-4 . "<OR")
)
)
-
i have another question also. i need to delete all of the layouts in the drawing but don't see how i could do that throught a macro without speciying the name which may vary.
Just step through the layout collection and delete the layouts. Not a problem. Just make sure the layout name is Model.
-
Just make sure the layout name is Model.
Are you seeing if we're awake Tim?
:)
-
Just make sure the layout name is Model.
Are you seeing if we're awake Tim?
:)
Nope. Good catch, as I'm not awake. Late night, and very little sleep. :wink:
-
uh i'm awake, barely, but don't know exactly how to look throught the layout collection. I think I've seen it done in some routines i have but never actually studied it. perhaps i'll investigate this weekend...or not :lmao:
-
Late night, and very little sleep.
You've my full sympathies Tim - take the rest of the day off!
-
Just make sure the layout is not named Model. As for getting that other thing working, if you got Ron's working, that's all you need. I'm glad you want to understand the point list one, but I'm too far removed to remember and am way to tired to research it. Ohhh, this is going to be a long 45 minutes of work that I have left.
-
I updated my last post with code to delete all layouts.
-
Late night, and very little sleep.
You've my full sympathies Tim - take the rest of the day off!
Thanks. If only I could. At least it's only 40 more minutes.