CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 3195

CAD tip CAD tip # 13536:

   
Question CAD 
 %  platform  category 
Q - question

iLogic: How to find if a document is a sheet metal part and if it contains holes?

A - answer An example of iLogic code that can be used to verify that the current document is a sheet metal part (sheetmetal .IPT) and whether or not it contains holes (both modeled and flat pattern holes).

You can use one of these three suggested methods to determine the type, resp. subtype of the "Sheet Metal" document:

If iProperties.Value("Project", "Document SubType Name") = "Sheet Metal" Then
 MsgBox("This is sheet metal 1")
End If

If ThisApplication.ActiveDocument.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
 MsgBox("This is sheet metal 2")
End If
	
Dim oPDoc As PartDocument = ThisDoc.Document
If TypeOf oPDoc.ComponentDefinition Is SheetMetalComponentDefinition Then
 MsgBox("This is sheet metal 3")
End If

Then use this iLogic code snippet to verify the presence of holes in the current sheet metal part:

i = 0 
'folded model holes?
For Each oFeature In ThisDoc.Document.ComponentDefinition.Features
 If oFeature.Type = ObjectTypeEnum.kHoleFeatureObject Then
  i = i + 1
 End If	
Next
'flat pattern holes?
For Each oFeature In ThisDoc.Document.ComponentDefinition.FlatPattern.Features
 If oFeature.Type = ObjectTypeEnum.kHoleFeatureObject Then
  i= i + 1
 End If	
Next
If i > 0 Then
 MsgBox("Contains holes")
Else
 MsgBox("Does NOT contain holes")
End If 
Inventor
100% *  CAD 
13.11.2022    924×  
Prices - CAD eShop:
applies to: Inventor ·

See also:
Tip 9692:Unfoldable spiral-helix sheet metal in Inventor.


Back   All CAD Tips



Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD:    OS:    Categ: 
Text:  FAQ glossary   



Featuring:
Publish interactive 3D PDF models from AutoCAD, Inventor or Revit with Share3D More info


Please use these tips at your own risk.
Arkance Systems is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist