| Author |
Message |
Clarence
Guest
|
Posted:
Fri Jan 07, 2005 3:11 am Post subject:
Too Many "select objects" |
|
|
As a favor, I'm trying to fix another individual's "personal autolisp command" Here's some portions of the code:
(SETQ SPEP (SSGET))
the code between these portions, basically create a block (SPEP) and then insert that block (SPEP) at different coordinates......
(while (not (eq etype "INSERT"))
(setq e (car (entsel)))<<<<<<want to get rid of this
(setq edata (entget e))
(setq etype (cdr (assoc 0 edata)))
)
The end portion rotates the inserted block at it new coordinates.
How do I reduce this down to selecting the objects one time only? I've tried variations that I've read from previous posts, and I haven't got it to work yet........
|
|
| Back to top |
|
 |
Clarence
Guest
|
Posted:
Fri Jan 07, 2005 3:14 am Post subject:
Re: Too Many "select objects" |
|
|
I've tried:
(setq e spep)
(if e
(progn
and I've tried:
(setq e (car (ssname spep 0)))
or at least something close to that.... |
|
| Back to top |
|
 |
T.Willey
Guest
|
Posted:
Fri Jan 07, 2005 3:17 am Post subject:
Re: Too Many "select objects" |
|
|
So the person want to rotate all the blocks that get inserted by there command? If some, then grab each block after it gets inserted (entlast) and add it to a list, then we there are done, do a foreach on the list of blocks.
Tim
|
|
| Back to top |
|
 |
Clarence
Guest
|
Posted:
Fri Jan 07, 2005 4:20 am Post subject:
Re: Too Many "select objects" |
|
|
clarification:
it is making xrefs and/or any other objects into a block and then inserting that block at a different location and angle.
So ssget is actually selecting multiple objects and entsel is where you select the block created from ssget.
is it even possible to reduce this down to one "select objects" propmpt?
Hi there, T, nice seeing you again! I'll give your suggestion a try and see how this goes.......
Thanks! |
|
| Back to top |
|
 |
T.Willey
Guest
|
Posted:
Fri Jan 07, 2005 4:43 am Post subject:
Re: Too Many "select objects" |
|
|
Can't you rotate it when you insert it?
I see your working hard to get that one routine going?
Good luck with them all.
Tim |
|
| Back to top |
|
 |
Clarence
Guest
|
Posted:
Fri Jan 07, 2005 8:21 pm Post subject:
Re: Too Many "select objects" |
|
|
I don't know exactly what this thing is supposed to accomplish. Seems very crude to me, but it's not for me, so I'll shut up. FYI - I want to remove one of the "select objects" and thats it.
here's the code for this one:
(DEFUN C:test ()
(PROMPT
"\nMOVE OBJECTS FROM EPPLEY COORDS TO STATE PLANES FT"
)
(setq OS (getvar "osmode"))
(setvar "osmode" 0)
(COMMAND "UNDO" "BEGIN")
(SETQ OLDERR *ERROR*)
(DEFUN *ERROR* (ERRMES)
(PRINC
(STRCAT "\nEP-SP HALTED BY THE FOLLOWING ERROR: " ERRMES)
)
(COMMAND "UNDO" "END")
(SETQ *ERROR OLDERR)
(COMMAND "UNDO" "1")
)
(SETQ SPEP (SSGET))
(COMMAND "-block" "objecttobemoved"
"2991908.80209610,616019.67552535"
SPEP ""
)
(COMMAND "-insert" "objecttobemoved"
"2768083.22150198,561217.87913841"
"1" ""
"0.0"
)
(setq etype nil
e nil
xscale 0.999623302
yscale 0.999623302
zscale 1
)
(command "zoom" "e")
(PROMPT "\nSelect Block Again ---")
(while (not (eq etype "INSERT"))
(setq e (car (entsel)))
(setq edata (entget e))
(setq etype (cdr (assoc 0 edata)))
)
(setq edata (subst (cons 41 xscale) (assoc 41 edata) edata)) ; X
(setq edata (subst (cons 42 yscale) (assoc 42 edata) edata)) ; Y
(setq edata (subst (cons 43 zscale) (assoc 43 edata) edata)) ; Z
(entmod edata)
(COMMAND "ROTATE" E
"" "2768083.22150198,561217.87913841"
"2.68598424"
)
; (COMMAND "EXPLODE" "L" "")
(setvar "osmode" OS)
(command "zoom" "e")
(SETQ *ERROR* OLDERR)
(COMMAND "UNDO" "END")
(princ)
)
the other one, BOY! I got everything figured out, then I hit a fatal snag. Fields have limited options making my command useless. I had a dialog box set up to pick objects from any space and place the field text in any space. The only thing I needed to complete it, was to figure out the field expression so I could get square yards and acres as well as square feet. But that isn't possible as of right now, at least that what I'm guessing from my lack of responses to my ng posts lately. Oh well, I guess I'll just have to wait for Civil3d from what I've been told. Apparently it will be able to do my autolisp command, that or they have their own variation of it.
Thanks for all of "your" help! |
|
| Back to top |
|
 |
T.Willey
Guest
|
Posted:
Fri Jan 07, 2005 8:59 pm Post subject:
Re: Too Many "select objects" |
|
|
See if this is what you are looking for. I commented out like 4 lines, and added one.
Tim
(DEFUN C:test ()
(PROMPT
"\nMOVE OBJECTS FROM EPPLEY COORDS TO STATE PLANES FT"
)
(setq OS (getvar "osmode"))
(setvar "osmode" 0)
(COMMAND "UNDO" "BEGIN")
(SETQ OLDERR *ERROR*)
(DEFUN *ERROR* (ERRMES)
(PRINC
(STRCAT "\nEP-SP HALTED BY THE FOLLOWING ERROR: " ERRMES)
)
(COMMAND "UNDO" "END")
(SETQ *ERROR OLDERR)
(COMMAND "UNDO" "1")
)
(SETQ SPEP (SSGET))
(COMMAND "-block" "objecttobemoved"
"2991908.80209610,616019.67552535"
SPEP ""
)
(COMMAND "-insert" "objecttobemoved"
"2768083.22150198,561217.87913841"
"1" ""
"0.0"
)
(setq etype nil
e nil
xscale 0.999623302
yscale 0.999623302
zscale 1
)
(command "zoom" "e")
;(PROMPT "\nSelect Block Again ---")
;(while (not (eq etype "INSERT"))
;(setq e (car (entsel)))
(setq e (entlast)) ;<-- here is what I added
(setq edata (entget e))
(setq etype (cdr (assoc 0 edata)))
;)
(setq edata (subst (cons 41 xscale) (assoc 41 edata) edata)) ; X
(setq edata (subst (cons 42 yscale) (assoc 42 edata) edata)) ; Y
(setq edata (subst (cons 43 zscale) (assoc 43 edata) edata)) ; Z
(entmod edata)
(COMMAND "ROTATE" E
"" "2768083.22150198,561217.87913841"
"2.68598424"
)
; (COMMAND "EXPLODE" "L" "")
(setvar "osmode" OS)
(command "zoom" "e")
(SETQ *ERROR* OLDERR)
(COMMAND "UNDO" "END")
(princ)
) |
|
| Back to top |
|
 |
T.Willey
Guest
|
Posted:
Fri Jan 07, 2005 9:03 pm Post subject:
Re: Too Many "select objects" |
|
|
Sorry to hear that you ran into a wall with your other one. I don't know anything about fields, but are you just trying to calculate the other areas? Could you just do the calculations within your routine, and the populate the fields, or is that not how fields are used?
Hope something comes along fast so all that effort won't be wasted. No problems about the help, I like helping when I have time and are able to.
Tim |
|
| Back to top |
|
 |
Clarence
Guest
|
Posted:
Fri Jan 07, 2005 9:25 pm Post subject:
Re: Too Many "select objects" |
|
|
thanks for revising that code. He's gonna test it out and tell me what he thinks.
here's what a field expression looks like:
%<\AcObjProp Object(%<\_ObjId 2125216024>%).Area \f "%lu6%qf1">%
The above expression (in A2k5), can be pasted into mtext dialog box and it will return area belonging to that object id.
the portion after the word AREA is what controls how many decimals and what units, but there's no documentation describing this syntax so I can change it to what I want.
And area is a read only variable so I can't set it to my calculations. I've tried many different approaches to this, and still haven't figured it out.
here's the few extra options in addition to what autocad provides.
http://www.cadforum.cz/cadforum_en/qaID.asp?tip=3676
hope this gives you a better idea of how fields work...... |
|
| Back to top |
|
 |
|
|
|
|