Jump to content
Developer Wiki and Function Reference Links ×

Function to get/set the indicator of Object Bounding Box


GioPet

Recommended Posts

  • Vectorworks, Inc Employee

You can't set the bounding box of an object. (OK, you can set the bounding box of some objects but it will cause them to resize.) You may be thinking about SetCustomObjectSelectionGroup\GetCustomObjectSelectionGroup

You will only be able to get the custom selection group if one has been set.

Link to comment

Hi and thank you both for your comments.

Hippocode: for what I am trying to achieve it is actually ok that the setting is global and affects all objects.

Kevin: thanks for suggesting the functions SetCustomObjectSelectionGroup\GetCustomObjectSelectionGroup

What I am trying to accomplish is to be able to set the indicator of the bounding box to the center so that I can use SetWidth and SetHeight to change the size of an object without the position of the object to change.

.. in this way I could work around without having to resize by calculating the new coordinates object (hope that make sense)

Thanks

G

Link to comment

What I am trying to accomplish is to be able to set the indicator of the bounding box to the center so that I can use SetWidth and SetHeight to change the size of an object without the position of the object to change.

.. in this way I could work around without having to resize by calculating the new coordinates object (hope that make sense)

Thanks

G

Why would you do that? Keep the user in mind please. Basically you want VW to behave differently and that will confuse the user! You should keep VW behaviour consistent (though VW on itself isn't very consistent...)

I don't know which objects you want to change and what behaviour you want them to have, but you can get the insertion point first, then adjust the height and widht, and then move them to their original insertion point.

If you want to have this on your own pio, then this is bad! a pio shouldn't have to know where it is at and shouldn't force it's insertion point. If you think it does, then you have chosen a wrong insertion point.

So please, can you give more info about what you need to do? In programming, there are always different solutions, but which one is better always depends on the context you are in.

EDIT: Sorry if my words come over harsh, English isn't my native language and I really want to help, I'm always happy to help others, but good coding/developing guidelines/rules are also important.

Edited by Dieter @ DWorks
Link to comment

Hi Dieter,

no worries, I appreciate you asking for more info to help figure this out.

I am working on a plugin tool that generates a series of graphic objects (rectangles and circles) and distributes them within a rectangular area defined by the user. The size, rotation and position of the objects are governed by a series of variables that are set by the user (with a sub -tool that writes the variables on a file).

although it sounds not particularly useful, this plugin is to be used for a very specific workflow.

If I was able to set the indicator of the bounding box at the center, then I could easily combine the variables (previously entered by the user) to set position, width and height of the objects by using the duplicate command. > this would be an easy thing.

Otherwise, I will have to create a series of equations to determine all coordinates of new objects.

I might be approaching this from the wrong programming-poin-of-view, so any comment is welcome.

G

PS: I haven't had a chance to try Kevin's suggestion

Link to comment

Not sure what Kevin's suggestion is supposed to do.

The custom selection group just allows you to customize the selection content which is highlighted when you select the object. This has nothing to do with object dimensions or insertion point.

From what I understand you can still use the command you want to use, instead from calculating from the center, you do your calculations from the left bounding box. I don't think it will be any different from starting in the center.

Edited by Hippocode
Link to comment

Giovanni-

What you're describing sounds like some Marionette nodes / networks that DomC has posted over at this thread.

Look at the second row from the top in the image below (copied from that thread); it allows you to set the rectangle's reference insertion point.

He also has some other node networks which randomly distribute symbols over a 2D or 3D polygon, see node example for filling an area with symbols

Maybe Marionette might help with whatever you're working on, just a thought.

HTH.

ubbthreads.php?ubb=download&Number=13051&filename=HandyNodesWrapper.jpg

Link to comment
If I was able to set the indicator of the bounding box at the center, then I could easily combine the variables (previously entered by the user) to set position, width and height of the objects by using the duplicate command.

Why using the duplicate command? Just create a function that will create the object, and call that in a loop with a different insertion point.

In VS, it's always easier to create an object than to edit it. Not that editing is that hard, creating is just simpler.

I don't know how your code is, but the placement and creation of objects usually don't go together, they are two different things, so if you split them in your code, it will be easier.

Maybe if we know what the parameters are and how you decide what the object is and how they are placed, then we could propose other solutions for you?

Edited by Dieter @ DWorks
Link to comment

Dieter,

thanks for pointing that out.

I can see what you mean when you say it's easier to create an object rather than editing it.

So I resolved it creating of the object with insertion point but, for this particular plug-in I worked on, the position of some of the objects is calculated in relation to the size/dimensions/position of previously created objects and in some instances it becomes easier to Duplicate+offset rather than figuring out the new insertion point.

thank you all for all the tips.

G

Link to comment
Dieter,

thanks for pointing that out.

I can see what you mean when you say it's easier to create an object rather than editing it.

So I resolved it creating of the object with insertion point but, for this particular plug-in I worked on, the position of some of the objects is calculated in relation to the size/dimensions/position of previously created objects and in some instances it becomes easier to Duplicate+offset rather than figuring out the new insertion point.

thank you all for all the tips.

G

I see what you mean. My DLegend plugin also creates the objects first, because I arrange them depending on their size, specially for the texts. What I do is create them at the (0, 0) point, then do the math, and then move them to their location. This is done with a for loop, as I keep the handles in an array.

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