Jump to content
Developer Wiki and Function Reference Links ×

Getting all parameters of build in objects (line, rects, ...)


KN_Michael

Recommended Posts

I have something like following:

 

VWObject obj = ...; // object comes from for each  iterator e.g.

VWParametricObj params = VWParametricObj(obj.GetThisObject());
for (int i = 0; i < params.GetParamsCount(); i++)
{
    //  read parameters...
}

My problem is, that I can't read the parameters of lines, rectangles and other simple build in objects. E.g. if obj.GetType() == kLineNode or kBoxNode, how can I get all existing parameters of this object?

 

Other things I tried:

Additionally, I tried GetCustomObjectDefinition, which seems not to work for build in object types. And VWRecordObj, but this does not work either, which makes sense, as I can see, that the build in object types do not contain any aux object of type kRecordNode...

Edited by KN_Michael
Link to comment

Those are not parametric objects (they have not type 86 (or what is it for parametric objects)).

 

You can check in the VWSDK, the path Include\Interfaces\VectorWorks\Objects. There are a few interfaces for simple VW objects.

 

Your code should check the type of the object (ISDK::GetObjectTypeN) and then use the class needed for the specific object.

Link to comment

For 2D objects, lines are defined by their end point, arcs by center, radius, and sweeps, and all other objects by their vertices. These aren't really parameters, but geometric data that you access with various other Get routines. VWLine2DObj, VWArc2DObj, and VWPolygon2DObj will give you a class to easily access these and any other calculated fields.

 

Plug-In Objects only have a position and rotation. They can also store a path and profile object in a special group. All other parameters are stored in a record field with the same name as the PIO.

 

Just a note, you can compress your code a bit:

 

VWParametricObj params(obj);

 

Link to comment

Thanks for the feedback. I'm aware that those objects are no plugin objects, my code only shows what I would like to have.

 

Finally I'm trying to write my own purge function for symbols. We are importing a lot into our layouts and therefore I want to find symbols that exist multiple times (I assume sometimes we have 500 symbols that are actually the same). I would like to avoid a switch for each type and handle lines, rectangles and other types on a per type base, I would like a more generic solution (like iterating over every parameter). As this approach is error prone as I may forget a type, may forget a property of a type and so on...

 

Quote

All other parameters are stored in a record field with the same name as the PIO. 

 

I was hoping that build in types do something like this as well. E.g. I can see something like "Coincident Duplicate Objects for" under the purge command - how does this command work? It finds duplicate objects and identifies them as duplicates - is there nothing that this command uses that I can use as well?

 

@JBenghiat, thanks for the code shortening hint

Edited by KN_Michael
Link to comment

I'm not sure if you're thinking of the term "parameter" correctly. A parameter specifically refers to the extra data attached to a PIO. If you want to handle all objects equally, you're limited to mostly the functions you have attached to VWObject: name, bounding box, class, etc.

 

What you are proposing is no small task. The purge command likely compares each object to all other objects, starting with object type, then class, then bounding box, etc. before then comparing specific attributes of that object type.

 

I assume that you're noticing duplicate symbols on importing DXF blocks. Often the duplicate symbols have slight variations from each other, like a rotation or translation, so each symbol is actually unique. You're also comparing entire contents of a symbol definition to the contents of all other symbol definitions, which is a fare amount of processing. You may be best off creating a feature request.

  • Like 1
Link to comment

A more specific explanation of WHY you want to do something might get you a better answer than a WHAT you want to do.

 

We understand that you want to compare and purge symbols, but a better explanation of where the symbols are coming from and how you end up with multiples that you want to delete will help us to give you a better answer.

 

 

Link to comment

So far I'm comparing following: object type, object class, bounding box, object matrix, all values of VWObjectAttr, and all values in VWParametricObj for custom objects. I'm aware that this is a heavy task, but I'm trying to solve it currently.

 

Duplicates come from imports as I've written above, especially from DWG imports. We do NOT control those imports, they come from other companies - so I can't improve anything on this side. We can see that there are apperantly duplicate symbols in the imported data - they are not unique and just differ in rotation or similar (although a smart purge could clean this as well, but this is not what I'm trying to do, that would be too much for now).

 

To answer the why, we have really large files because we have a lot of data in each file so we are trying to optimise whatever is possible. We need to import stuff from other formats where we do not control data nor the format, again a lot of data comes into our files. Last but not least, our colleagues never work perfectly, which additionally leads to the need to optimise layouts...

 

Additionally, we have already created a feature request for this purge command, but we won't get it in the near future (if ever), so I try to write my own solution for now.

 

Edited by KN_Michael
Link to comment

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