I have a bunch of drawings where a previous colleague did not follow design standards and the title blocks are all over the place. I am attempting to write a script that will select all the objects on the drawing and move them to 0,0 with the first point being relative to the lower left corner of the title block. (FYI, there are no blocks in these drawings. The titleblock itself is just lines and text; another thing I want to fix.)
I found these lines which get me very close:
(command "zoom" "object" "all" "")
(command "move" "all" "" (getvar "extmin") '(0 0))
The problem I am having I think has to do with the BASE value.
After running the above lines the titleblock are located at -0.25,-0.25. I discovered that the base was set to -0.25,-0.25. This should be simple; I set BASE to 0,0 and tried the above again. No change. Nothing I do seems to have any affect. If I start a new drawing and throw some objects on it and run the above code, everything works as expected.
I feel that this should have been a slam dunk but am stymied as to why I cannot get rid of this offset.
Does anyone have any clues?
Thanks in advance for any help.
Solved! Go to Solution.
Solved by cadffm. Go to Solution.
1. Handle your objectsnap, use "_none" in front of your coordinates.
Or in your case: Use "_END" in front of the first coordinate (your (getvar "extmin") statement, and "_None" in front of the 0,0,0
2. As first step set your UCS to world
3. Offtopic: Base set the basepoint for this DWG, nothing to do with things inside this DWG (just important for inserting this dwg to another file by Insert as Block or Xref.)
If you don't why you set the base (insbase), use 0,0,0 wcs coordinates as insbase setting.
Sebastian
Try to do a google search for a lsp program called "Zero.lsp". It would flatten all entities in a drawing.
Thanks for the suggestion but that did not do it.
I even erased every thing from the drawing, purged and then just drew 3 simple object; Rectangle, circle, and Line.
I then did the zoom and move command strings and still have the same thing. The EXTMIN is being offset by 0.25,0.25 from where it should be.
Sebastian,
#2 was the problem. The USC was set to *NO NAME*. As soon as I set it to World everything works as expected.
I knew it had to be something simple.
Thanks so much!
My bad, thought you wanted to remove the z values. Wow someone really jacked up a drawing. You could try a select similiar and change the x and y values in your properties box. It may help saving some stuff if its in the rightful place.
@testsubject schrieb:
I then did the zoom and move command strings and still have the same thing. The EXTMIN is being offset by 0.25,0.25 from where it should be.
Extmin is not exactly what you thing, it is not reading your object properties, but please try this:
Run your ZOOM EXTENTS
then set treedepth, for example by using the following line:
(setvar "treedepth" (getvar "treedepth"))
then use EXTMIN
Is it better now?
Sebastian
Sebastian,
I realize that extmin returns the Extents minimum coordinates. For what I am doing this is fine. I am doing Zoom Object; not Zoom Extents.
Thanks for your help.
Whats the difference in your case (object selection ALL)??
But I wrote about Extents and Treedepth because of i was searching for your problem.
( at this point i didn't read that my other post about object snaps was the solution for you)
Why treedepth: Because the value of Exmin/Extmax is often wrong!!
The workaround is to re-set treedepth.
In a standard/automation process you have to make sure that what you do will ever works fine,
in case of your script you should add the treedepth statement in front of your move-statement.
Your welcome
Sebastian
Thank you for the suggestion. I will give it a try.
Can't find what you're looking for? Ask the community or share your knowledge.