PDA

View Full Version : elevation routine


Robert.Hall
2007-06-27, 04:15 PM
I am having major elevation issues today.........

Is there a way that I can have autocad check an entire drawing to make
sure the z elevation is zero for all objects?

A routine that will do a z elevation check upon opening a drawing would be
very helpful in my situation. I work in 2d and knowing is half the battle.

Mike_R
2007-06-27, 07:06 PM
I must say, I learned something new with this one, being relatively new myself, so thanks for requesting it! Anyway, after a little time, here ya go...

(defun c:checkelev (/ offlist e1 LP)
(setq e1 (entnext)
LP T
)
(while LP
(foreach item (entget e1)
;;;Checks Z values of all objects and subobjects in the entire drawing.
(if (and (= (vl-list-length item) 4)
(= (nth 0 item) 10)
(/= (nth 3 item) 0.0)
)
;;;If Z is not zero, puts object in selection set
(setq offlist
(cond
((null offlist) (ssadd e1))
(T (ssadd e1 offlist))
) ;end cond
) ;end setq
) ;end if
) ;end foreach
;;;if no more objects in drawing, end while.
(if (null (setq e1 (entnext e1)))
(setq LP nil)
) ;end if
) ;end while
;;;Checks for any objects in the non-zero selection set.
;;;if so, select them. If not, let me know.
(if offlist
(sssetfirst nil offlist)
(alert "All objects at Zero Elevation.")
) ;end if
(princ) ;exit quietyle
) ;end defun

Robert.Hall
2007-06-28, 02:32 PM
How do I make this routine autorun when I open a drawing?

So, if I can see grips selected, then I have non zero objects?

Mike_R
2007-06-28, 04:13 PM
Yes. If anything is selected, then some part of them is off 0.0z, if there's nothing off of 0.0z, then the alert box pops up to let ya know, so you're not searching the drawing to find what's selected.

As for having it autorun everytime a drawing is opened..... it would probably need a few changes. Missed that part of your first post.

How would you rather have it work? Select objects that are off? Inform you that some objects are off and that you'd need to run the selection routine to find out what they are? Inform you of how many objects are off? Lemme know and I'll see if I can do it... I'll never use this routine so it's all up to you.

Mr Cory
2007-11-19, 11:43 PM
Is there anyway to get this lisp to automatically set the elevation to 0? And for it to work via ssget?

CADDmanVA
2007-11-20, 04:07 AM
I'm not very LISPy, but I'll tell you how I do it...

Ctrl+A to select all. Using the pull-down on the Properties Pallet, I'll cycle through all the objects and zero out the offenders. Minus the Ctrl+A, this would be a good step two after using the LISP above.

As for the autorun... What if you had the LISP as part of the Startup Suite, then had acad.lsp run that LISP when opening a new drawing?

Mr Cory
2007-11-20, 04:16 AM
Most of my work is 3D so the ctrl+A wouldnt work the same but its a good point :) im just trying to be ultra lazy ;) >select object > hit 0 and move on.

CADDmanVA
2007-11-20, 06:05 AM
Most of my work is 3D so the ctrl+A wouldnt work the same but its a good point :) im just trying to be ultra lazy ;) >select object > hit 0 and move on.

Umm...I dunno about you, but we call that ultra efficient around here... :mrgreen:

Mr Cory
2007-11-20, 08:21 PM
Umm...I dunno about you, but we call that ultra efficient around here... :mrgreen:

Haha, well yeah thats true, k im trying to be ultra efficient then ;) i wonder if ill stop being called lazy :lol:

margaretl
2007-11-20, 11:10 PM
Ultra Efficient - Working smarter, NOT harder. :)

Opie
2007-11-22, 04:42 AM
The cartoon discussion has been relocated to the CWC forum.

Let's keep it on topic.

Mr Cory
2007-11-22, 04:43 AM
cheers Opie

Speaking of which... Anythoughts? or pointers?

Opie
2007-11-22, 05:25 AM
cheers Opie

Speaking of which... Anythoughts? or pointers?
What is your question?

You want this to run automatically? You should add a line in your ACADDOC.LSP file to (load [i]Insert file name here.lsp") and run the (c:checkelev) that Mike posted earlier.

Are you wanting this to select all items in the drawing or do you want the user to select items? If you want it to run automatically upon drawing open, I would have it run on all items in the drawing. I would also not recommend user interaction during this process.

Mr Cory
2007-11-22, 05:28 AM
Not quite, basically i would like the user to select an object type "0" and then the lisp would set the elevation to 0.

Opie
2007-11-22, 05:51 AM
Not quite, basically i would like the user to select an object type "0" and then the lisp would set the elevation to 0.
An object type "0"? What is that?

I would have to send you to do a search on flatten routines. I'm not up to reinventing that wheel.

Good luck.

Mr Cory
2007-11-22, 10:30 PM
Sorry '0' was just the shortcut lol.

Its not really a flattening routine im after, they typically turn 3d objects to 2d? Ill try a search, i just thought it would be easier to modify this one seem the bone are already there. Nevermind though thanks for your time :)

Opie
2007-11-22, 10:33 PM
Sorry '0' was just the shortcut lol.

Its not really a flattening routine im after, they typically turn 3d objects to 2d? Ill try a search, i just thought it would be easier to modify this one seem the bone are already there. Nevermind though thanks for your time :)
Have you tried the Express Tools -> Flatten command?

Mr Cory
2007-11-22, 10:37 PM
Just did but that turns objects into 2d, i want them to stay 3D but just be moved to 0 elevation

CADDmanVA
2007-11-23, 12:36 AM
Just did but that turns objects into 2d, i want them to stay 3D but just be moved to 0 elevation
Scratching head...but doesn't zeroing the elevation of an object in essence, make it 2D?

Mr Cory
2007-11-23, 01:27 AM
Haha, nar not when the objects are 3D to begin with, say a 3D wall (ADT Wall object) which has its own 'elevation'

i used (entget(car(entsel)))

here is some of what it returned



((-1 . <Entity name: 7c09eeb8>) (0 . "AEC_WALL") (330 . <Entity
name: 7c08ecf8>) (5 . "9D8B7") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8
. "L1-Wall") (100 . "AecDbEntity") (102 . "{AEC_SUBOBJECT") (300 .
"AecImpWallLinear") (100 . "AecImpObj") (3 . "") (100 . "AecImpEnt") (171 . 0)
(100 . "AecImpGeo") (10 14826.3 -4505.61 0.0) (15 1.0 0.0 0.0) (16 0.0 1.0 0.0)
(210 0.0 0.0 1.0) (360 . <Entity name: 0>) (100 . "AecImpWall") (102 .


the highlighted is what i what to change, well just the Z value anyway.

Opie
2007-11-23, 03:44 AM
Hopefully this is what you are wanting. You are wanting a routine to select an object, request user input of the new elevation, then adjust the object's z coordinate to match the user input?

Mr Cory
2007-11-23, 03:50 AM
Yeah thats it :) it doesnt have to prompt the user, it could be set to match Z = 0

CADDmanVA
2007-11-23, 05:44 AM
I got what you mean now. I wasn't thinking about 3D objects with a [base] Z value themselves...duh!

Mr Cory
2007-11-23, 05:45 AM
Yeah sorry i didnt explain very well :|

CADDmanVA
2007-11-23, 03:32 PM
Yeah sorry i didnt explain very well :|

Not necessarily...I was pretty hopped up on turkey last night... :mrgreen:

Mr Cory
2007-11-25, 08:25 PM
Turkey :? I not even going to ask ;)

CADDmanVA
2007-11-26, 01:54 AM
Turkey :? I not even going to ask ;)

Sorry. Sometimes I forget what the "I" in AUGI stands for. Thursday was Thanksgiving in America. It's a tradition that I gorge myself on turkey, then use that as an excuse for anything dumb I do in the following 48 hours. :mrgreen:

Mr Cory
2007-12-13, 09:24 PM
Any thoughts anyone? :|

tedg
2007-12-13, 10:07 PM
Any thoughts anyone? :|
Try checking here (http://forums.augi.com/showthread.php?t=39606) where I had posted an "ELZ" lisp routine where you select objects and hit "enter" and it puts them at elevation zero.

good luck :beer:

Mr Cory
2007-12-13, 10:12 PM
Hey Ted that looks like it will work perfectly, just want to add in some more object types. Is it as simple as adding the object to...


(setq ent (ssget '((-4 . "<OR")(0 . "LINE")(0 . "TEXT")
(0 . "POLYLINE")(0 . "LWPOLYLINE")(0 . "VERTEX")(0 . "ARC")
(0 . "CIRCLE")(0 . "ELLIPSE")(0 . "INSERT")
(0 . "MTEXT")(0 . "POINT")(-4 . "OR>")))


or is it a little more involved than that?

tedg
2007-12-13, 10:21 PM
Hey Ted that looks like it will work perfectly, just want to add in some more object types. Is it as simple as adding the object to...


(setq ent (ssget '((-4 . "<OR")(0 . "LINE")(0 . "TEXT")
(0 . "POLYLINE")(0 . "LWPOLYLINE")(0 . "VERTEX")(0 . "ARC")
(0 . "CIRCLE")(0 . "ELLIPSE")(0 . "INSERT")
(0 . "MTEXT")(0 . "POINT")(-4 . "OR>")))
or is it a little more involved than that?
That should work, give it a whirl.

Mr Cory
2007-12-13, 10:39 PM
LEGEND! That works perfectly thanks heaps! when i was searching, i didnt search for flatten routines as they didnt do what i was after, hence your one didnt show up. Thanks again!

Mr Cory
2008-03-03, 01:34 AM
This doesnt seem to work for plines? And i cant firgure out why :?

ccowgill
2008-03-03, 01:16 PM
Hey Ted that looks like it will work perfectly, just want to add in some more object types. Is it as simple as adding the object to...


(setq ent (ssget '((0 . "LINE,TEXT,*POLYLINE,VERTEX,ARC,CIRCLE,ELLIPSE,INSERT,MTEXT,POINT")))
or is it a little more involved than that?

you could try the above, it is a little shorter, and accomplishes the same thing, notice the * in front of polyline

Mr Cory
2008-03-04, 11:01 PM
It still has no effect of the polylines elevation, thanks none the less

marko_ribar
2008-03-11, 06:48 PM
Why don't you try to make block of all objects, erase all objects, insert block with z scale 0.00000001 and then explode block...

This small z value is similar to zero, so if some lines were passing each other and in top view projection they crossed, now you will be able to snap to its intersection (of course from "plan" of WCS - top view)...