how to point to objects?

Discuss and ask questions about CADViewX (Lite and Pro versions).

Moderators: SDS, support, admin

Post Reply
roberto
Posts: 8
Joined: 30 Jan 2010, 20:17

how to point to objects?

Post by roberto » 06 Feb 2010, 12:50

I have to point to some objects of a DWG draw.
For example to a block named "CircleA" in which there is a red filled circle.
The most intuitive way to point it is to browse the blocks by CADViewX1.CADImage.Blocks(n) until I find it.
It works, but the returned box points are wrong!
And then, how can I point to some attributes of the circle (i.e. the origin point, the radius or the fill color)?
In your sample are used some classes I don't understand well, like Insert and Converter (in the standard AutoCad structure they don't exist).
Where can I find the rules to navigate across the objects?

best regards

Roberto

support
Posts: 3253
Joined: 30 Mar 2005, 11:36
Contact:

Re: how to point to objects?

Post by support » 09 Feb 2010, 12:36

Hello.
The CADViewX.CADImage.Blocks represents list of block entities for this file. However the blocks aren't located within drawing space. Based on AutoCAD specification blocks contained in special "Blocks" section. Drawing contain block references - insert entities. Converter class is a special class of our software, it contain all entities of the drawing.
The insert from your drawing can be accessed by browsing entities collection: CADViewX.CADImage.Converter.Entities.
Any attributes of circle or other entities within insert object can be accessed as insert's child entities attributes.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

roberto
Posts: 8
Joined: 30 Jan 2010, 20:17

Re: how to point to objects?

Post by roberto » 10 Feb 2010, 13:06

Regarding Block the answer is clear: in the draw are painted only instances of the blocks (they are in a different space).
In the following answer there is something I cannot understand: You say that if I want to browse entities collection I have to point CADViewX.CADImage.Converter.Entities(i), but class Converter has not the propriety Entities!
Is "Layout.Iterate vConverter" the only way to point to Entities or Insert? (in my IDE I have difficulties to intercept events of an OCX sub-class).

best regards

Roberto

support
Posts: 3253
Joined: 30 Mar 2005, 11:36
Contact:

Re: how to point to objects?

Post by support » 10 Feb 2010, 16:57

Hello.
Sorry, I gave you some incorrect information. Entities can be accessed via CADViewX.CADImage.Converter.Sections[csEntities].Entities.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

roberto
Posts: 8
Joined: 30 Jan 2010, 20:17

Re: how to point to objects?

Post by roberto » 12 Feb 2010, 17:59

Hi Alexander,
So is clearer! Now I can point to all Entities of the draw, but there are still two tasks I cannot achieve:

1) Using the path you gave me (CADViewX.CADImage.Converter.Sections(2).Entities(i)) I can browse all Entities and sub-Entities but I have to know the base point of a block and this is given by Insert.Point
How can I address Insert (without the use if it's possible of Iterate used in the sample)?

2) It seems to me that the radius of a circle is given by Circle.Radius
How can I address Circle starting from the block that holds that circle?

best regards

Roberto

support
Posts: 3253
Joined: 30 Mar 2005, 11:36
Contact:

Re: how to point to objects?

Post by support » 15 Feb 2010, 18:11

Hello Roberto.

1. You don't need to use Iterate method if you know entity's index in Entities[] list, any entity can be accessed via its index. Otherwise using Iterate is most correct way.

2. Insert object have its own Entities property. This list contain child entities of Insert's block. You can access any child entity via Insert.Entities or Block.Entities properties using index.
Another way is using Iterate method. If CADImage.Converter.AutoInsert = true then Iterate will call for child entities of insert's block, otherwise for Insert entities.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

roberto
Posts: 8
Joined: 30 Jan 2010, 20:17

Re: how to point to objects?

Post by roberto » 15 Feb 2010, 20:23

Hi Alexander,
you are really gentle and perhaps I'm not so skilled in VB (or perhaps I'm thick as a brick).
I know that if I want to point to an object I must use the correct path in the library.
The root is always my OCX object (i.e. CADVIEWX1). To reach the object I want I have to explore the connections inside the sequences of the classes. You gave me the right path to reach an Entity (CADViewx1.CADImage.Converter.Sections[2].Entities). In this way I obtained all my draw objects (inserted blocks, circles, etc.) limited to the properties exposed by the Entity class.
Which is the path to reach the properties of an Insert or a Circle?
Can you give me a code example?

thank you

Roberto

support
Posts: 3253
Joined: 30 Mar 2005, 11:36
Contact:

Re: how to point to objects?

Post by support » 16 Feb 2010, 17:24

Hello Roberto.
Thank you. I'm sure in your skills in VB, we just need add more info into help. In CADViewX library entities realized as classes and you can access entities' properties as any other class object property. There are parent classes and descendant classes. For example descendance graph for Circle entity looks like: TEntity -> TGroup -> TPolyline -> TCircle. And: CADViewx1.CADImage.Converter.Sections[csEntities].Entities.Radius will give you access to radius of Circle entity object. If your Circle object is inside Insert object then access to its Radius property will be like: CADViewx1.CADImage.Converter.Sections[csEntities].Entities.Entities.Radius where second Entities is the Circle entity from list of child entities of Insert object.
Unfortunately our help sysem currently doesn't contain information about entities. You can gain more information about entities structure in CADViewX by opening and viewing CADViewX.OCX in your development environment.
One more thing. Using Sections[csEntities] is more correct then Sections[2] because possibility of changing this constant in the future versions.

If your question is not answered completely or you have other questions, please do not hesitate to ask.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

roberto
Posts: 8
Joined: 30 Jan 2010, 20:17

Re: how to point to objects?

Post by roberto » 17 Feb 2010, 14:09

Hi Alexander,
Great!! your explanation is clear: when I point to an Entity and the EntityName is "CIRCLE" the Entity "is" the object Circle, so I can get all the properties of it (and the same for all the kind of entities).
Without your help it should have been very hard to understand the concept. Thank you!

So if I can get all these properties I can also set them (I was thinking and hoping), but... it doesn't work in this way: I've tried to change the value of the circle's Radius but (using the method CADViewX1.CADImage.RefreshCurrentLayout) it has not changed the draw (i've red again the Radius and the new value is properly set)... and trying to change the base point of inserted block "Circle1" it doesn't change the values (I've red again the property Point and the values are the old ones). What's wrong?
Please, help me (i promise it is my last sub-question).

thanks so much

Roberto

support
Posts: 3253
Joined: 30 Mar 2005, 11:36
Contact:

Re: how to point to objects?

Post by support » 18 Feb 2010, 11:11

Hello Roberto.
You need to load entity which property/properties was/where changed into converter before your changes will be displayed:
CADViewX1.CADImage.Converter.Loads(your_entity);
This method must be called for every changed entity before refreshing.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

roberto
Posts: 8
Joined: 30 Jan 2010, 20:17

Re: how to point to objects?

Post by roberto » 20 Feb 2010, 13:26

Hi Alexander,
half of the last problem it's solved.
Using CADViewX1.CADImage.Converter.Loads(your_entity) the circle shows itself with the new dimension (changing of course the Radius).
But when I want to move the inserted block "Circle1" in another position of the draw I try to change the value of Point.X and Point.Y of Insert and the values don't change! (without errors, but values don't change).
What have I to do to move an inserted block in a different position of the draw?

Thanks

Roberto

support
Posts: 3253
Joined: 30 Mar 2005, 11:36
Contact:

Re: how to point to objects?

Post by support » 24 Feb 2010, 18:47

Hello Roberto.
Please set the entity's position using CADViewX1.MkFPoint(x, y, z) method.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply