Jump to content
Sign in to follow this  
VvierA

How do I convert a symbol to a custom plug-in object?

Recommended Posts

Hi there,

I made a Vectorscript menu command that automatically places symbols in the drawing.

Now I'd like the Vectorscript to 'convert' the symbols to custom plug-in objects.

The purpose is to have access to the parameters defined within the Vectorscript menu command from within the object info palette.

The Vectorscript command should 'transform' the symbols to custom plug-in objects before placing them in the drawing.

Any ideas?

Thank you

VvierA

Share this post


Link to post
Hi there,

I made a Vectorscript menu command that automatically places symbols in the drawing.

Now I'd like the Vectorscript to 'convert' the symbols to custom plug-in objects.

The purpose is to have access to the parameters defined within the Vectorscript menu command from within the object info palette.

The Vectorscript command should 'transform' the symbols to custom plug-in objects before placing them in the drawing.

Any ideas?

Thank you

VvierA

Well, just use CreateCustomObject or the equivalent for path based objects.

What you then pass as parameters or content depends on your plug-in.

You can for instance use the symbol name in a parameter of the object or maybe your object requires a symbol in the path/profile group etc etc...

Also keep in mind that you will need to use the offset of the symbol as insertionpoint of your object. Depending on your needs, rotations about axises as well.

Edited by Hippocode

Share this post


Link to post
Hi there,

I made a Vectorscript menu command that automatically places symbols in the drawing.

Now I'd like the Vectorscript to 'convert' the symbols to custom plug-in objects.

The purpose is to have access to the parameters defined within the Vectorscript menu command from within the object info palette.

The Vectorscript command should 'transform' the symbols to custom plug-in objects before placing them in the drawing.

Any ideas?

Thank you

VvierA

What do you mean convert symbols to custom plug-in objects? They are totally different. Do you have a use case? I think you are looking for a custom object instead of a menu command, one that will use a symbol in it. Please tell us your use case so we can come with good solutions.

Share this post


Link to post

Well, just use CreateCustomObject or the equivalent for path based objects.

Hello Hippocode,

thank you for the input. If I am right, my problem is:

The 'CreateCustomObjekt' commands need the name of the object.

So I have to create a custom plugin object tool with a certain name in the first place to use it within my Vectorscript menu command. I would be happy if there was another way.

I'd like VW to create custom objects directly by only using the Vectorscript menu command. I'd like to call the menu command and than it should populate the drawing with symbols that are not only symbols but custom objects.

Share this post


Link to post

What do you mean convert symbols to custom plug-in objects? They are totally different. Do you have a use case? I think you are looking for a custom object instead of a menu command, one that will use a symbol in it. Please tell us your use case so we can come with good solutions.

Well, I am looking vor a custom object, that is generated by a menu command.

I know that it is possible to program a custom object and to 'call' this object from within a menu command. But that is not what I want. I'd like to generate the custom object directly with the menu command. In this special case I'd like a symbol to be part of the newly generated custom object.

What's the purpose?

I'd like to program a stamp, that shows the area and perimeter of polygons.

It is used by selecting polygons and applying a menu command to call a Vectorscript.

The menu script reads the area an perimeter of each polygon and places a symbol with text showing the area and perimeter next to each polygon. I'd like the symbol to be part of a custom object. So I can access the object info palette for this 'stamp object' and make changes, for example select another symbol or scale the symbol and so on.

Share this post


Link to post

What you are trying to do is possible, but I believe you don't understand what a plug-in object is.

You need to DEFINE a custom plug-in object, that takes a symbol or easier, a symbol name so it can generate it on resetting. This is something you can't do automatically, its coding work to do ;)

With your menu command, you search the poly you wish to label, then call CreateCustomObject to CREATE an instance of your custom object, bound to the polygon you have a handle on.

Share this post


Link to post

I know that it is possible to program a custom object and to 'call' this object from within a menu command. But that is not what I want. I'd like to generate the custom object directly with the menu command. In this special case I'd like a symbol to be part of the newly generated custom object.

The only solution you have is what I've highlighted. You can't aspect VW to generate an object for you from scratch, without knowing what it should do. This is something you need to set up.

Share this post


Link to post

I've done that before. I programmed a plug in object as a tool.

Then I programmed a menu command, that called that plug in object to generate several instances of it in the drawing.

Now I'd like to merge the two pieces of code into one.

Why would I do that? Because I don't need the plug in object as a separate tool. I only need it in combination with that menu command that populates the drawing with instances of it.

But maybe that is not possible and I have to do it separately.

Share this post


Link to post

I've done that before. I programmed a plug in object as a tool.

Then I programmed a menu command, that called that plug in object to generate several instances of it in the drawing.

Now I'd like to merge the two pieces of code into one.

Why would I do that? Because I don't need the plug in object as a separate tool. I only need it in combination with that menu command that populates the drawing with instances of it.

But maybe that is not possible and I have to do it separately.

You don't need the tool, ok.

But the thing is, when creating a plug-in with VS, VW will automatically create a tool for it so you can place it in the drawing. Luckily for you you don't need to code that tool which leaves you to the object only. That is why you need to choose the plug-in type (2Dpoint, rectangle, polygon....)

If you use the SDK, you can keep this separate. I've got several objects that don't have a tool because other objects / tools place them in the drawing.

That being said, a tool or not, the only way to add an object this way is trough CreateCustomObject. This won't trigger the tool btw.

Share this post


Link to post

I've done that before. I programmed a plug in object as a tool.

Then I programmed a menu command, that called that plug in object to generate several instances of it in the drawing.

Now I'd like to merge the two pieces of code into one.

Why would I do that? Because I don't need the plug in object as a separate tool. I only need it in combination with that menu command that populates the drawing with instances of it.

But maybe that is not possible and I have to do it separately.

So you want to merge two totally different things then. Not possible.

- The object is an object with parameters, that's one thing.

- The menu command is just there to place those symbols, nothing else.

It's better to keep those separate, as they don't have anything to do with each other.

Share this post


Link to post

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.

Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...