iLogic: Get extents of a sketch?

iLogic: Get extents of a sketch?

mthomas
Collaborator Collaborator
702 Views
4 Replies
Message 1 of 5

iLogic: Get extents of a sketch?

mthomas
Collaborator
Collaborator

Is there some method to get the extents (i.e. bounding box) of a sketch? I'd like the vertical and horizontal dimension.

 

Thanks

Mike Thomas

703 Views
4 Replies
Replies (4)
Message 2 of 5

MjDeck
Autodesk
Autodesk

It should be possible.  The rule would have to use API code to get the bounding box (RangeBox) of each SketchEntity in the sketch, and merge all the RangeBoxes.  That would give you the extents along the horizontal and vertical directions of the sketch.    The RangeBox is not guaranteed to be a tight bounding box.  For curved geometry, it might be larger than necessary.

Note that the sketch geometry might be rotated, or in some way not aligned with the sketch H and V directions.

 


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 3 of 5

danny.lewisA9QBW
Advocate
Advocate

@mthomas Mike... here's the solution to getting the bounds of a sketch. The secret sauce is the code that ignores the construction lines.

 

https://forums.autodesk.com/t5/inventor-customization/ilogic-ignore-construction-lines-on-sketch-ext...

 

I'm sure you've already found a work around; so this is mostly for anyone else looking for the solution.

Message 4 of 5

R.Mabery
Advocate
Advocate

I believe you'll still run into issues with the values being "off" if the sketch contains splines as described here:

 

https://modthemachine.typepad.com/my_weblog/2017/06/getting-the-overall-size-of-parts.html

 

I say "off" because the bounding box would include the control polygon.

 


Thanks,
Randy Mabery
Applications Expert
IMAGINiT Technologies
0 Likes
Message 5 of 5

danny.lewisA9QBW
Advocate
Advocate
Likely very true; but the coding would still cover most instances that we'd be using the iLogic. If you're drawing a shape with a pile of splines, sweeping and then expecting generic programming to magically do all the work for you.... Well... I think it might be time for more reasonable expectations 😛
0 Likes