Jump to content
Sign in to follow this  
GioPet

Function to get/set the indicator of Object Bounding Box

Recommended Posts

I am looking for a function to get/set the indicator of the Bounding Box of an object. I couldn't find one in the resource library..

Any suggestion/help would be greatly appreciated!

G

Share this post


Link to post

Never came across such a "setting".

Also note that this setting is not object based but global. If you change it it will change for all objects.

Share this post


Link to post

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.

Share this post


Link to post

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

Share this post


Link to post

Maybe if you post in the mailinglists someone has an answer, I did a quick sweep in the SDK but couldn't find anything.

Oh well math is fun ;)

Share this post


Link to post

as in your signature, a bit of sudoku is always good!

thanks fir checking the SDK!

i think I better get started with my equations...

G

Share this post


Link to post

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

Share this post


Link to post

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

Share this post


Link to post

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

Share this post


Link to post

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

Share this post


Link to post

Thanks TIm!

this looks great, definitely an interesting direction to investigate!

will keep you all posted on results.

G

Share this post


Link to post

You're welcome Giovanni.

If you double click on a Marionette node, it will show you the underlying Python code; This might help you figure out how DomC was setting the reference insertion point.

Share this post


Link to post
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

Share this post


Link to post

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

Share this post


Link to post
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.

Share this post


Link to post

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.

Nice suggestion!

I'll try implementing for my plug-in too.

G

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