Best way to detect if part is flat

Best way to detect if part is flat

Anonymous
Not applicable
594 Views
8 Replies
Message 1 of 9

Best way to detect if part is flat

Anonymous
Not applicable

Hello, 

 

I need to check if a sheet metal is flat or if it hase some bends..

 

I was thinking to compare the thickness with Z-value of it s bounding box.. if it is the same then it is flat..

 

is there a better way?

 

If this is the best way, how can i retrieve the thickness in code?

 

thank you! 

0 Likes
Accepted solutions (1)
595 Views
8 Replies
Replies (8)
Message 2 of 9

basnederveen
Advocate
Advocate

I am looking for the same thing, I was worried about using the rangebox when the plate is not in one of the (XY,YZ etc) workplanes.



0 Likes
Message 3 of 9

Anonymous
Not applicable

me too, but on the otherhand i run my code on the IPT file, and on that file the thickness is always aligned to one of the axes.. (at least should be if you dont make a mess while drawing.. 😄 )

0 Likes
Message 4 of 9

basnederveen
Advocate
Advocate

We use skeleton parts so it is not guaranteed that the part is parallel to one of the planes... And if I'm correct the 'rangebox' is parallel to the coordinate system

0 Likes
Message 5 of 9

Anonymous
Not applicable

well, that makes ONE good exception.. 😄 but does not apply to my case...

0 Likes
Message 6 of 9

AlexFielder
Advisor
Advisor

In your case @basnederveen I guess you could prompt the user to select the longest, flattest face (for those parts which aren't parallel to the major axes) and work from that?

 

I guess it depends on whether you would want the rule to function manually or not.

0 Likes
Message 7 of 9

marcin_otręba
Advisor
Advisor

Dim doc As PartDocument

Set doc = ThisApplication.ActiveDocument

Dim oFlatPattern As FlatPattern
Dim ocompdefs As SheetMetalComponentDefinition

Set ocompdefs  = doc.Componentdefinition

Set oFlatPattern = ocompdefs.FlatPattern
if oFlatPattern.FlatBendResults.Count>0 then

Msgbox "Part is not flat"

endif

 

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 8 of 9

Anonymous
Not applicable

thank you,. will this work also for files that do not have bends but maybe use contoure?

0 Likes
Message 9 of 9

marcin_otręba
Advisor
Advisor
Accepted solution

yes, for all kinds of sheetmetal...

in case if you don't have flat pattern in part...:

 

   If ocompdefs.HasFlatPattern = False Then
              ocompdefs.Unfold
               Set oFlatPattern = ocompdefs.FlatPattern
     oFlatPattern.ExitEdit

endif

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders