Jump to content
Developer Wiki and Function Reference Links ×

How do I get a handle to a symbol within a PIO?


VvierA

Recommended Posts

Hello again,

thanks for the help with the other issues.

I have a 2D path PIO with an embedded symbol.

Does anybody has a clue how to get a handle to a symbol that is nested inside a PIO?

I'd like to make another Vectorscript to manipulate the POI objects inside the drawing. Therefore I need to get a handle to the symbols inside the POI objects.

Any ideas?

Link to comment
Hello again,

thanks for the help with the other issues.

I have a 2D path PIO with an embedded symbol.

Does anybody has a clue how to get a handle to a symbol that is nested inside a PIO?

I'd like to make another Vectorscript to manipulate the POI objects inside the drawing. Therefore I need to get a handle to the symbols inside the POI objects.

Any ideas?

I'm not going to say it's impossible, but you should not do it this way.

You need to send information to the parent PIO, so it recalculates and redraws using your modified parameters.

Changes made to geometry in a PIO, not handled by the PIO recalculate event often look corrupt on the screen, particularly with symbols.

To get a handle to the symbol there are 2 ways:

- Traverse the contents of the parent PIO. A PIO is a group like object, and you can traverse everything inside.

- You could make it so the PIO has a Unique ID, and the Symbol has another Unique ID, based on the PIO one + some static characters.

This way, you can quickly find the symbol, with the unique name of the PIO.

Edited by Hippocode
Link to comment

@Hippocode

Thank you for the help.

The background is:

I can generate a list on a worksheet with the database info of the symbols that are embedded in the PIOs.

I can edit the retrieved database info in the worksheet.

If the database info was linked directly to the object, Vectorworks would rewrite the data to the object.

Because the database info is linked to the embedded symbol and not to the PIO directly this does not work.

Therefore I'd like to read out the edited database info and send this info to the parameters of the PIO to match both.

I think I'll try this:

I can get a handle to each PIO. Then I search within each PIO for the symbol with record information and get a handle to this. With this handle I read out the record entry for the symbol and patch it to the PIO parameters with the PIO's handle.

Link to comment

Yes, the PIO should always be in control of the internal geometry and data, unless you make very special objects that do not redraw on each reset.

I'm not sure that is possible with VS. I do it with some of my plug-ins, using the SDK. Only on certain events, the PIO redraws it's contents. In any other, it keeps it's data instead of recreating it.

What I do with my SymbolObject, is that whenever someone selects a symbol to display, it also copies all attached symbol records and assigns them to the SymbolObject itself. Then, every reset of the SymbolObject copies this data into the internal symbol. This way they both have the same data attached, and the client can still control the symbol data without having to explode the PIO.

Edited by Hippocode
Link to comment

Sorry for asking again, but I don't know really how to traverse the PIO to get a handle to the symbol within.

I have an handle in an array of handles to every PIO I'd like to check for contained symbols. I thought, I could look 'inside' every PIO with....

ForEachObjectInList(actionFunc, objOptions, travOptions, list)

With travOptions = 1

I should bei able to traverse inside the PIO.

But what's the 'actionFunc' to get a handle to the symbol inside the PIO?

And what do I use vor 'objOptions' and 'list'?

Thanks for help again

Link to comment

Ok, thanks again.

So I can cycle through the objects within the PIO.

One of them will be a symbol.

You surely have an idea how to identify the symbol and how to get a handle to it?

I did some research in the Vectorscript reference but I am still not sure, what to use.

Thank you and good evening

Link to comment

While traversing the handles inside that container, you need to verify it is a symbol.

GetObjectTypeN() tells you what kind of type the handle is. If its a symbol you can start doing your magic.

Note that if your symbol could be part of a group, inside your PIO, you need to search recursively.

Link to comment

@Miguel

The symbol within my PIO has some text that is linked to a database record.

I like to read out this info an write it to the PIO parameters of the parent PIO.

Why would I do that?

In some cases I'd like to edit the database record entries from within a worksheet list.

Vectorworks changes the info in the text symbol that is linked to the database accordingly.

The problem is: the correlative parameters of the PIO do not change automatically.

If the PIO gets refreshed by another reason (for example resizing etc.) the database entries will be changed back to the values that are still 'stored' in the PIO parameters.

Therefore I'd like to write a script to sync the database entries to the PIO parameters.

Maybe I can work out how to traverse the PIO and how to identify the embedded symbol thanks to Miguel.

I'm not a Pro so any additional help will be appreciated very much.

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