• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

extract the coordinates of the basic point of definition of a block

  • Thread starter Thread starter Giuseppe Beatrice
  • Start date Start date

Giuseppe Beatrice

Guest
Hello, everyone.
I am working with the elements of a block definition, which I extract with the "tblsearch" function followed by "tblnext"; I would also need to know, if possible, the coordinates of the base point of the block, then used as a reference point for each insertion of the block itself.
from the online help on the dxf codes it seems to me to understand that this is possible, accessing the "block" entity and reading the association with code 10, but the extraction with the "tblnext" function makes me access only to the graphic components of the block definition, so I do not know how to access the "block" entity of the block definition.
how can I extract then the coordinates indicated above, and these always coylate with the base point, even when I fix it in different position from the origin with the "basic point" parameter of dynamic blocks?
thanks for the availability.
 
I solved the first part of the problem.
I realized that, to question the definition of each block, I just need to use in sequence the function (tblnext "block").
However, I have the problem of knowing the base point position when this is fixed as a dynamic block parameter in a different position than that (normally 0 0 0) applied by default in creating a block.
In fact the function "tblnext" always returns to me such coordinates, even when I change the position of the base point.
Thanks again.
 
I'm sorry if I insist on this, but I'm particularly interested.
the function (tblsearch "block" xxx), where xxx represents the name of the block to question, returns a list of bet pairs including one of the type (10 0.0 0.0 0.0 0.0), which are -according to the online help instructions- the coordinates of the base point of the block definition.
What I can't understand is: because even if I insert a base point with different coordinates (with the "basic point" parameter of dynamic blocks), the question always returns me the coordinates 0.0.0?
if the answer is always the same, what does it mean then that code 10 returns the basic point?
exists the possibility to use some type command (vlax-get-....) to extract the "real" coordinates of the base point?
Thanks again to those who can help me.
 
creating the "base point parameter" within bedit, the insertion point of that block is not changed in the model.

If you do a test see that the block moved from where you put it, but not its base point.

:smile:
 
I agree perfectly.
I have the problem of knowing the meaning of the "base point" associated with the code dxf 10 in the definition of block (readed with the tblsearch function relative to the block to be questioned) and why always give me as a result the coordinates 0.0.0.
or, as an alternative, can I know with some vlisp function the coordinates, of course related to the definition of block, of a base point different from the original one of the block and attributed with the basic point parameter of dynamic blocks?
Thanks for the answer.
 
I'm still here to break. . .
I also tried to "see" the content of the object returned from the vlax functions..., but the basic point is not there.
possible that, if you move the base point into a block definition, its coordinates cannot be read anywhere?
 
test with vla-get-insertionpoint

in fact vla-get-origin provides the coordinates of the base point of the "definition" block (acadblock), while vla-get-insertionpoint provides the coordinates of insertion of the single block instance (acadblockreference) according to the terminology of activex.
 
Last edited by a moderator:
Dear Joseph, I thank you for the suggestion but unfortunately this is not the information I have to extract. I do not need to know the coordinates with which each block is inserted in the drawing, but the coordinates of the application point of the definition of block.
since I am trying to build an automatic block legend contained in the drawing, I go to insert a block for each different instance in the layout.
in case the block, for convenience of insertion, has the origin point (or base point) very decentralized regarding its geometric center, unfortunately the insertion in the relative cell of the legend entails a consequent decentralization (at times unacceptable) regarding its description.
for this I would like to obtain precisely the coordinates of the base point of the definition of block, for power from time to time calculate the geometric center and then the offset with which to insert the block in the legend.
I hope I've been clear and I'm waiting for any clarifying answers.
 
Giuseppe
Unless you use a basepoint parameter, a block definition always originates in the relative 0.0.0 coordinates of the block.
I try to explain myself better.
try to activate the block editor of any block (which does not contain a basepoint parameter).
moves objects from any point you choose, to the coordinates 0.0.0 (of the internal ucs system of the block).
close the block and you will see to move all the blocks as if you had changed its base point (what you did with the old basic command).

same behavior you get if you enter a basepoint parameter, but honestly, I don't know how to find the definition in the block list (I don't know the dxf group).
However this to tell you that in the definition of the block, you will always find the base point at 0.0.0, because it is what autocad autonomously establishes as the base point of the block.
Try to take a line from the model, play a block and choose as a base point (in the creation stage) an end. opening the block will find that end to the coordinates (local) 0.0.0.
I hope you will be useful
 
Unfortunately, in this period I can't absolutely devote some time to trials, but, given what you have to create, I recommend that you leave the point of insertion (of the definition) and beat other roads, the simplest seems to me to be this:

- insert the block with insertion point 0.0
- calculate the boundingbox of the block to get the central point, or simply with an object zoom and memorizing the viewctr variable, you will get the discard from the insertion point
- clear the block

the boundingbox option also allows you to calculate the actual size of the block according to the right scaling of the same in the legend box.

:smile:

edit
p.s. other method, enter the block where you want and align it, with the scaling option, choosing as points origin two extremes of boundingbox and points Destination the two homologues of the legend box.
 
there are enormously grateful for attention and valuable advice.
Anyway, I think I fixed... at least this problem, thanks to the comments of all of you.
In practice, I precisely calculated the coordinates of the central point of the definition of block, and therefore I calculated theangle e la distance relative to point (0 0) which always coincides with the base point.
I then used these values to insert the block into a "moved" point with the function (polar angle distance).
only a small final curiosity... When gp talks about "limiting box question" to calculate the coordinates, does it mean to enter the block definition and calculate the geometric center of the various graphic entities that compose it or means something different?
anyway, thanks again to everyone! !
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top