Jump to content

Recommended Posts

Posted

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

Posted

can't you utilize the OSnap INSERTION, isn't that the BASE-point?

Posted

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

Posted

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: base

Enter 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

Posted

When the following prompt you , you can insert the new coordinates which is .....

 

Command: base Enter base point : 0,0,0

Posted

How can i record this prompt and put it in a variable?

Posted

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.

Posted
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...

Posted

Are you trying to change the base points for all blocks in a dwg to 0,0,0 ?

Posted

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.

Posted

 

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.:D

(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

Posted

(setq pt (getpoint "\n Base point of Objects :"))

 

This info should be returned by the command prompt after entering the "base" command.

 

Command: base

Enter base point :

 

SB

Posted

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.

Posted
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:

Posted (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 by Lee Mac
Posted

Perfect, like always :D.

So "insbase" it is.

Thanks a lot Lee !

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...