Message 1 of 11
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
has anyone changed sheet metal styles from the assembly?
I'm trying to run the ChangeStyleToNewOne rule on each of the sheetmetal parts in an assembly, but it's not working.
Does anyone have any ideas how I can fix it?
Sub Main() Dim thisAssyDoc As AssemblyDocument = CType(ThisDoc.Document, AssemblyDocument) AddCusProp(thisAssyDoc) End Sub Sub AddCusProp(assemblyDoc As AssemblyDocument)
For Each subCompOcc As ComponentOccurrence In assemblyDoc.ComponentDefinition.Occurrences Dim oPartDoc As PartDocument= subCompOcc.ActiveEditDocument If oPartDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Dim oscCompDef As SheetMetalComponentDefinition = oPartDoc.ComponentDefinition Dim ActiveStyle As SheetMetalStyle = oscCompDef.ActiveSheetMetalStyle ChangeStyleToNewOne(ActiveStyle) ElseIf oPartDoc.SubType = DocumentTypeEnum.kAssemblyDocumentObject Then AddCusProp(oPartDoc.Definition.Document) End If Next End Sub Sub ChangeStyleToNewOne(ActiveStyle) If ActiveStyle = "10ga GA Brt" Then SheetMetal.SetActiveStyle("10ga GA Brt (Test)") ElseIf ActiveStyle = "10ga GA Jkt" Then SheetMetal.SetActiveStyle("10ga GA Jkt (Test)") ElseIf ActiveStyle = "10ga SS 304L Solid" Then SheetMetal.SetActiveStyle("10ga SS 304L Solid (Test)") ElseIf ActiveStyle = "12ga GA Brt" Then SheetMetal.SetActiveStyle("12ga GA Brt (Test)") ElseIf ActiveStyle = "12ga GA Jkt" Then SheetMetal.SetActiveStyle("12ga GA Jkt (Test)") ElseIf ActiveStyle = "14ga GA Brt" Then SheetMetal.SetActiveStyle("14ga GA Brt (Test)") ElseIf ActiveStyle = "14ga GA Jkt" Then SheetMetal.SetActiveStyle("14ga GA Jkt (Test)") ElseIf ActiveStyle = "14ga SS 304L Solid" Then SheetMetal.SetActiveStyle("14ga SS 304L Solid (Test)") ElseIf ActiveStyle = "16ga GA Brt" Then SheetMetal.SetActiveStyle("16ga GA Brt (Test)") ElseIf ActiveStyle = "16ga GA Jkt" Then SheetMetal.SetActiveStyle("16ga GA Jkt (Test)") ElseIf ActiveStyle = "16ga SS 304L Solid" Then SheetMetal.SetActiveStyle("16ga SS 304L Solid (Test)") ElseIf ActiveStyle = "18ga GA Brt" Then SheetMetal.SetActiveStyle("18ga GA Brt (Test)") ElseIf ActiveStyle = "18ga GA Jkt" Then SheetMetal.SetActiveStyle("18ga GA Jkt (Test)") ElseIf ActiveStyle = "18ga SS 304L Solid" Then SheetMetal.SetActiveStyle("18ga SS 304L Solid (Test)") ElseIf ActiveStyle = "20ga GA Brt" Then SheetMetal.SetActiveStyle("20ga GA Brt (Test)") ElseIf ActiveStyle = "20ga GA Jkt" Then SheetMetal.SetActiveStyle("20ga GA Jkt (Test)") Else SheetMetal.SetActiveStyle("Default") iProperties.Value("Project", "Stock Number") = "Material no disponible para tolerancias" iProperties.Value("Project", "Description") = "Material no disponible para tolerancias" End If End Sub
Solved! Go to Solution.