Hello I am trying to figure out if there is a way to add something to this code to make it work for my other parts as well. Right now I have it fill in a custom iProperty called "Material" if certain sheet metal styles are selected. What I would like I am not sure if you can do or not. I want a statement that is if non of these prompt for entry. So if its not any of these selected materials I want it trigger a free text form. Is that possible? I really don't want different drawing templates for my non sheet metal parts?
You could add something to your if statement like
Else
Dim MyMaterial As String
MyMaterial = InputBox("Custom Material", "User Input Material", MyMaterial)
iProperties.Value("Custom", "Material") = My Material
End If
but there are many different ways to do it that might be better in the long run for you.
This is the part I have just a couple of the materials in right now eventually I will be adding 250. Any help is appreciated I am hoping to not have to have a separate drawing file for items that are not sheet metal.
Not sure exactly what the final result your looking for but try this in your Rule1.
Dim oSheetMetalCompDef As SheetMetalComponentDefinition
oSheetMetalCompDef = ThisDoc.Document.componentdefinition
Dim YourStyle As String
yourStyle = oSheetMetalCompDef.ActiveSheetMetalStyle.Name
Dim oDesc As String
oDesc = iProperties.Value("Custom", "Description")
Dim oType As String
oType = iProperties.Value("Custom", "TYPE")
If yourStyle="10GZ01X03" Then
oDesc = "10 GA GALVANIZED G90"
oType = "GALVANIZED"
ElseIf yourStyle="12HR02B91" Then
oDesc ="HR A1011 TYPE B P/O"
oType = "STEEL HRPO"
ElseIf yourStyle="250HR05X03" Then
oDesc = "250 HR A572 50MIN HSLA"
oType= "STEEL 50 MIN"
Else
oDesc = InputBox("Custom Material Description", "User Input Material", oDesc)
oDType = InputBox("Custom Material Description", "User Input Material", oType)
End If
End Sub