Message 1 of 13
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
I'm trying to check wether a component is active i.e. not suppressed in a for each loop to get the DXF if and only if the part is active in the assembly.
I've tried just about anything but without any success.
The rule is as follows:
question = MessageBox.Show("Do you want to save to DXF?", "iLogic Question",MessageBoxButtons.YesNo,MessageBoxIcon.Question) 'set condition based on answer If question = vbYes Then ' ==============================* Get DXF *==================================== DXF_LOC = ThisDoc.Path & "\DXF\" Dim asmDoc As AssemblyDocument = ThisApplication.ActiveDocument Dim oDoc As Inventor.Document For Each oDoc In asmDoc.AllReferencedDocuments If Not oDoc.DocumentSubType.DocumentSubTypeID = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Continue For oDocName = oDoc.Displayname ' If component is Active proceed If iProperties.Value(oDocName ,"Summary", "Keywords") = "ISM" Then Dim oCompDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition ' Check if part has flat pattern, create if not If Not oCompDef.HasFlatPattern Then oCompDef.Unfold oDoc.Save oDoc.Close End If ' DXF config Dim sOut As String = "FLAT PATTERN DXF?" _ + "AcadVersion=2004" _ + "&OuterProfileLayer=IV_OUTER_PROFILE:Visibility=ON;LinePattern=28100;LineWeight=0,0500;Color=0,128,0;" _ + "&InvisibleLayers=IV_TANGENT;IV_BEND;IV_BEND_DOWN;IV_ROLL_TANGENT;IV_ARC_CENTERS" Dim sFname As String = "" Select Case oDocName Case "HB132.ipt": sFname = "IF-H-LAMIR-" & FVG & "-" & Parameter("HB132:1", "Lengd") & "X" & Parameter("HB132:1", "Breidd") Case "HB133.ipt": sFname = "IF-H-LASINN-" & FVG & "-" & Parameter("HB133:1", "Lengd") & "X" & Parameter("HB133:1", "Breidd") Case "IFK-YFIRSTYKKI.ipt": sFname = "IFK-YFIRSTYKKI-" & Parameter("IFK-YFIRSTYKKI:1", "Lengd") & "X" & Parameter("IFK-YFIRSTYKKI:1", "Breidd") Case "PANNA-H.ipt": sFname = "PANNA-H-" & Parameter("PANNA-H:1", "Lengd") & "X" & Parameter("PANNA-H:1", "Breidd") Case "BYRÐI-H.ipt": sFname = "BYRDI-" & BNFP & "-H-" & Parameter("BYRÐI-H:1", "Lengd") & "X" & Parameter("BYRÐI-H:1", "Breidd") Case "Skuffa-LL.ipt": sFname = "SKUFFA-LL-" & Parameter("Skuffa-LL:1", "Lengd") & "X" & Parameter("Skuffa-LL:1", "Breidd") Case "Thr-Profill.ipt": sFname = "Thr-Profill-" & Parameter("Thr-Profill:1", "Lengd") & "X" & Parameter("Thr-Profill:1", "Breidd") Case Else: ' Halda áfram End Select If sFname <> vbNullString Then oCompDef.DataIO.WriteDataToFile(sOut, DXF_LOC & sFname & ".dxf") End If End If ' End If Next 'Component.IsActive("Skuffa-LL:1") = 0 RuleParametersOutput() InventorVb.DocumentUpdate() Else ' Nothing End If
I have no idea how or what to use to get the IsActive to work. I've been trying to find answers here and elsewere and tried to adjust what I have found to my specific problem without success.
How do I go from a document to an occurrence in the assembly: HB132.ipt -> HB132:1
Is there a simple way to do this?
Solved! Go to Solution.