Sittingbull Posted February 18, 2011 Share Posted February 18, 2011 Hi all, I've got drawings who are made from wblocks. They were part of one drawing before, and so the base point is not 0,0,0 anymore. Is it possible to record the echo of the command "base" ? I thought i could use it as the selection point to move everything back to point 0,0. SB Quote Link to comment Share on other sites More sharing options...
Tiger Posted February 18, 2011 Share Posted February 18, 2011 can't you utilize the OSnap INSERTION, isn't that the BASE-point? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 18, 2011 Share Posted February 18, 2011 I guess you can get a coordinate of any entity that existed within the wblocks and the source drawing and according to that coordinates you can relocate or adjust your new base point to the drawing (wblocks). Hope this help . Tharwat Quote Link to comment Share on other sites More sharing options...
Sittingbull Posted February 18, 2011 Author Share Posted February 18, 2011 It's not the base-point of a block, but the base of the drawing. Here's one of these drawings: e.g.dwg Open it and try "base" command. You'll see it's not 0,0. Command: baseEnter base point : So if i insert this dwg into another drawing, the base point would be somewhere average. Actualy it would be the 0,0,0 point of the orriginal drawing from where this part is comming from. I can manualy select everything, choose a first(base) point, and then choose point 0,0 as second point. But i'ld like to do that with lisp, to process more files at ones. So i thought, the base command, actualy gives me the base point of this part. I could use it to move all back to point 0,0 and than reset "base" back to orrigin. SB Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 18, 2011 Share Posted February 18, 2011 When the following prompt you , you can insert the new coordinates which is ..... Command: base Enter base point : 0,0,0 Quote Link to comment Share on other sites More sharing options...
Sittingbull Posted February 18, 2011 Author Share Posted February 18, 2011 How can i record this prompt and put it in a variable? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 18, 2011 Share Posted February 18, 2011 Is this what you mean ? (setq NewPT '(0.0 0.0 0.0)) Quote Link to comment Share on other sites More sharing options...
Tiger Posted February 18, 2011 Share Posted February 18, 2011 ah...guess you can't direct a Lisp to use the Insertion point of a block as the first point in a move-command... At least I can't find the "storage-variable" that matches the BASE-command. I don't know lisps, so will bow out after this suggestion without Lisp-usage: I would use QSelect to select all blocks in the drawing, then bring up the Properties pane and change the Insertion POint XY values to 0,0. Not that hard, but it would take time if you have many drawings. Quote Link to comment Share on other sites More sharing options...
Sittingbull Posted February 18, 2011 Author Share Posted February 18, 2011 the "storage-variable" that matches the BASE-command I guess it's what i'm after. I thought it would be possible to record and save what the prompt returns after "base" input... Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 18, 2011 Share Posted February 18, 2011 Are you trying to change the base points for all blocks in a dwg to 0,0,0 ? Quote Link to comment Share on other sites More sharing options...
Sittingbull Posted February 18, 2011 Author Share Posted February 18, 2011 Are you trying to change the base points for all blocks in a dwg to 0,0,0 ? Not realy. There are no blocks in the drawing. It's the base of the dwg itself i want to reset, after using it's value in a variable. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 18, 2011 Share Posted February 18, 2011 I can manualy select everything, choose a first(base) point, and then choose point 0,0 as second point. But i'ld like to do that with lisp, to process more files at ones. SB Is this what you mean ? Note: Unlock and Turn on all layers before your invoke the routine to guarantee fruitful outcome. (defun c:Test ( / pt ss) ; Tharwat 18. Feb 2011 (vl-load-com) (if (and (setq pt (getpoint "\n Base point of Objects :")) (setq ss (ssget "_x" )) ) ((lambda (i / ss1 o ) (while (setq ss1 (ssname ss (setq i (1+ i)))) (setq o (vlax-ename->vla-object ss1)) (vla-move o (vlax-3d-point pt) (vlax-3d-point '(0.0 0.0 0.0))) ) ) -1 ) (princ) ) (princ) ) Tharwat Quote Link to comment Share on other sites More sharing options...
Sittingbull Posted February 20, 2011 Author Share Posted February 20, 2011 (setq pt (getpoint "\n Base point of Objects :")) This info should be returned by the command prompt after entering the "base" command. Command: baseEnter base point : SB Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 20, 2011 Share Posted February 20, 2011 Why on earth would you want to change the INSBASE System Variable? I might be wrong but I always thought one should not change the INSBASE Variable, and use the origin (0,0,0) as the basepoint for all blocks - I thought this was a standard in most companies. Quote Link to comment Share on other sites More sharing options...
Sittingbull Posted February 20, 2011 Author Share Posted February 20, 2011 Why on earth would you want to change the INSBASE System Variable? Exactly!!! The guy who maed the library had these composed drawings. So he made wbloks out of it. He didn't moved the geometry to the 0,0,0 point. He left if like that and defined a base point. I've got drawings who are made from wblocks. They were part of one drawing before, and so the base point is not 0,0,0 anymore. That's why i'ld like to reset them:wink: Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 20, 2011 Share Posted February 20, 2011 (edited) This should fix your drawings: (defun c:FixIns nil (vl-load-com) ;; © Lee Mac 2011 ( (lambda ( p1 p2 / ss ) (if (ssget "_X") (progn (vlax-for obj (setq ss (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)) ) ) (vla-move obj p1 p2) ) (vla-delete ss) (setvar 'INSBASE '(0. 0. 0.)) ) ) ) (vlax-3D-point (trans (getvar 'INSBASE) 1 0)) (vlax-3D-point '(0. 0. 0.)) ) (princ) ) Edited February 20, 2011 by Lee Mac Quote Link to comment Share on other sites More sharing options...
Sittingbull Posted February 20, 2011 Author Share Posted February 20, 2011 Perfect, like always . So "insbase" it is. Thanks a lot Lee ! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 20, 2011 Share Posted February 20, 2011 You're welcome SittingBull. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.