Message 1 of 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The code below allows me to insert an ipt and set the parameters during insert, all works well
in the code there is a portion to set the stock number based on the parameters , for some reason it sets the stock No to the ipt's original values not the ones stated during insert
can some one assist please as i need it to use the values set during insert
Dim oAsm As AssemblyDocument = ThisDoc.Document Dim oPath As String = ThisDoc.Path If oPath = "" MessageBox.Show("Message", "Title", MessageBoxButtons.OK) End If Dim oCode As String = InputBox ("Code:W,S,OM,EX,", "Code","?") Dim oThickness As String = InputBox("Thickness:", "Thickness", "2") Dim oDia As String = InputBox("Diameter 80 - 400:", "Duct Diameter", "ENTER") Dim oLength As String = InputBox("Length:", "Length 500,1000,2000", "2000") Dim oFlange As String = InputBox("Flange:", "Flange", "6mm LIP") If System.IO.File.Exists(oPath & "\"& " Ø"& oDia & " Straight Duct" & " x " & oLength & "mm x " & oThickness & " Thick, " & oFlange & ".ipt") Then ThisApplication.CommandManager.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, oPath & "\"& " Ø"& oDia & " Straight Duct" & " x " & oLength & "mm x " & oThickness & " Thick, " & oFlange & ".ipt") ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyPlaceComponentCmd").Execute Else Dim oTemplate As String = "J:\Inventor Library\Ducting\JKF_DUCT.ipt" Dim pDoc As PartDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, oTemplate, False) pDoc.ComponentDefinition.Parameters.Item("DIA").Expression = oDia pDoc.ComponentDefinition.Parameters.Item("Length").Expression = oLength pDoc.ComponentDefinition.Parameters.Item("Thickness").Expression = oThickness pDoc.Update ThisApplication.UserInterfaceManager.DoEvents iProperties.Value("Project", "Stock Number")= ("oCode" &"/"& "oDIA" & "/" &"oLength") pDoc.SaveAs(oPath & "\" & " Ø"& oDia & " Straight Duct" & " x " & oLength & "mm x " & oThickness & " Thick, " & oFlange & ".ipt", False) pDoc.Close ThisApplication.CommandManager.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent,oPath & "\"& " Ø"& oDia & " Straight Duct" & " x " & oLength & "mm x " & oThickness & " Thick, " & oFlange & ".ipt") ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyPlaceComponentCmd").Execute End If oAsm.Update
Solved! Go to Solution.