Get the coordinates of the corners of the "blue box"
-
Hello, I would like to know how I can get the coordinates of the 8 corners of the "blue box" of a group or component that has been rotated and scaled

I tried to
bounds.cornerorlocal_bounds.cornerbut do not work properly for what I need, I have been looking and I could not find the appropriateness.
-
help

-
-
I know you helped me very much, sorry for asking much just I want to learn
-
Check out the source of this plugin that draws edges of the boundingbox: http://forums.sketchucation.com/viewtopic.php?t=29377#p256536
-
@thomthom said:
Check out the source of this plugin that draws edges of the boundingbox: http://forums.sketchucation.com/viewtopic.php?t=29377#p256536
Thom thank you very much.
I know I need this in lines 66 to 68 of your code:definition = self.get_definition(entity) bb = definition.bounds pts = self.bound_points(bb).map { |pt| pt.transform( entity.transformation )is a shame that is not yet ready to understand these lines clearly, however I will be very useful, very grateful
(sorry for my bad English)
-
Get's the ComponentDefinition of the ComponentInstance or Group
definition = self.get_definition(entity)Get's the bounds of the definition - note that if you get the bounds of the instance it will be a Boundingbox aligned to the model axis - not the instance axis. Which is why you need to get the definition bounds.
bb = definition.boundsNow transform the points of the definition boundingbox with the transformation of the instance.
pts = self.bound_points(bb).map { |pt| pt.transform( entity.transformation )In other words, get the boundingbox of the definition and apply the instance transformation to the coordinates of that boundingbox.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better š
Register LoginAdvertisement