Noob - Selection set problems
I just wanted to start off saying that I'm new to lisp and this forum and would appreciate any info.I use a dated architectural add-in called ArchT.It uses enhanced commands to move, copy, etc architectural objects.The application redefines stock autocad commands with their own enhanced versions to provide functionality with their own objects.Unfortunately Autocad crashes when any of these commands involve blocks with attributes.As a bandaid, I've written a lisp routine that will get a selection set and separate out all blocks with attributes and place them into a separate selection set.I was then hoping to move the blocks separately (and transparently) using ._copy or ._move.All of this would not require any more clicks or user input.This is when the problems begin....
I can not access ArchT's enhanced commands through autolisp because I believe they are lisp functions themselves.In other words, when I type (command "_move") it gives me an unknown command error.I can call the function (kti_archt_move) but it accepts no parameters and only allow user input (ie screen input).
Is there any other way I can call this command? Could I create a macro that would pause for my selection set routine and then call the command I need?
Sorry for being wordy, but I have seemed to hit a wall in every direction I turn.I am unsure about all the ins and outs of the i/o system for lisp.Any help would be greatly appreciated.Thanks
Christian Figured I would try to bump.Anyone have any ideas? Hi
Could you post a sample code of what you have written so far?
You are probably correct with this
For simple routines a work around can be achieved via a script file
See
http://www.cadtutor.net/forum/showthread.php?t=32685&page=2
http://www.cadtutor.net/forum/showthread.php?t=38450
Could you post a sample of the command line prompts for the (kti_archt_move)
Regards
Jammie when you first select an object manually then initiate your custom ArchT command, does it process your pre-selected entitiesor does it ask you again for your selection set? try vla-move and vla-copy to bypass using the command call Hi Jammie,here is the code to get the selection set and separate the objects:
(setq SelMain(ssget))(setq SelMainSize(sslength SelMain))(setq SelBlock(ssadd))(setq SelNoblock(ssadd))(setq ctr 0)(while (< ctr (sslength SelMain)) (setq Ent(ssname SelMain ctr)) (setq EntData(entget Ent)) (if (assoc 66 EntData) (setq SelBlock(ssadd Ent SelBlock)) (setq SelNoblock(ssadd Ent SelNoblock)) ) (setq ctr(+ ctr 1)))(sssetfirst nil SelNoblock)Regarding the Archt commands, they mimic the stock autocad commands exactly.Here is what the archt move command does at the command line:
Command: kti_archt_moveSelect objects: Specify opposite corner: 1 foundSelect objects:Base point or displacement: Second point of displacement:I'm not sure how to use scripts but I will look into this.Thanks!
Hi wizman, I tried what you said, and the command does work with the pre-selected object.
Hi John,I'm not sure how to use these (or vlisp for that matter), but I will read up on them.Thanks. These will help you with the Visual LISP:
(defun v-move (ss p1 p2 / i ent) (vl-load-com) (setq i -1) (while (setq ent (ssname ss (setq i (1+ i)))) (vla-move (vlax-ename->vla-object ent) (vlax-3D-point p1) (vlax-3D-point p2))) ss)(defun v-copy (ss p1 p2 / i ent) (vl-load-com) (setq i -1) (while (setq ent (ssname ss (setq i (1+ i)))) (vla-move (vla-copy (vlax-ename->vla-object ent)) (vlax-3D-point p1) (vlax-3D-point p2))) ss)(defun c:test (/ ss pt1 pt2) (if (and (setq ss (ssget "_:L")) (setq pt1 (getpoint "\nFrom: ")) (setq pt2 (getpoint pt1 "\nTo: "))) (v-move ss pt1 pt2)) (princ))
"ss" is a SelectionSet, p1, p2 are points. Hi Lee,
Thanks for the vlisp code.Any help is greatly appreciated.I don't see how this can help me though.I need to be able to move certain objects through the ArchT routine so that I can retain ArchT object functionality.
For example, I have walls with centerlines, windows, doors, etc.If I select a wall centerline through the ArchT command, the whole object moves along with the doors and windows in that wall.If I just use the standard move command, only the selected object moves and the assembly breaks. I was under the impression that you needed a workaround to move your separate selection set - the above code is your workaround.
Ah I see
That part I was fairly comfortable with in lisp.Sorry if I am not explaining this properly.The problem I'm having is not being able to pass my modified selection set to the ArchT command.This is the step I need to prevent autocad from crashing.Once I accomplish this, then I think I can integrate your code to move the other selection set........or the obvious could just be flying over my head .
页:
[1]
2