Changing sheetmetal style of a Lofted Flange using iLogic

Changing sheetmetal style of a Lofted Flange using iLogic

RogerdeSmidt
Participant Participant
79 Views
2 Replies
Message 1 of 3

Changing sheetmetal style of a Lofted Flange using iLogic

RogerdeSmidt
Participant
Participant

Hi All,

 

I have a multi-body sheetmetal part with multiple lofted flanges, each created as a new body and each has a different sheetmetal rule assigned to it. I would like to be able to change the sheetmetal rule using iLogic.

I have only managed the code below and could probably add bed radii and kfactors to it, but can't seem to figure out how to change the sheetmetal rule for these features. I want to change the rule rather than just the thickness, bend radius and kfactor because this is the base component from which sheet metal parts are derived and we keep the sheet metal styles linked between them. 

 

Dim oPartDoc As PartDocument = ThisDoc.ModelDocument
Dim oFeatures As PartFeatures = oPartDoc.ComponentDefinition.Features

For Each oFeature As PartFeature In oFeatures
	If oFeature.Name() = "Loft 1" Then
		Dim oLoftedFlangeDef As LoftedFlangeDefinition = oFeature.Definition()
		oLoftedFlangeDef.SheetMetalRule.Thickness = LOFT_1_THICKNESS
	Else If oFeature.Name() = "Loft 2" Then
		Dim oLoftedFlangeDef As LoftedFlangeDefinition = oFeature.Definition()
		oLoftedFlangeDef.SheetMetalRule.Thickness = LOFT_2_THICKNESS
	End If
Next

 

 Any constructive advice would be greatly appreciated.

 

Kind regards.

0 Likes
Accepted solutions (1)
80 Views
2 Replies
Replies (2)
Message 2 of 3

marcin_otręba
Advisor
Advisor
Accepted solution

use:

 

Dim oPartDoc As PartDocument = ThisDoc.ModelDocument
Dim oSmDef As SheetMetalComponentDefinition=oPartDoc.ComponentDefinition
Dim oFeatures As PartFeatures = oSmDef.Features

For Each oFeature As PartFeature In oFeatures
	If oFeature.Name() ="Loft 1" Then
		Dim oLoftedFlangeDef As LoftedFlangeDefinition = oFeature.Definition()
		oLoftedFlangeDef.SheetMetalRule=oSmDef.SheetMetalStyles("1,0")
	Else If oFeature.Name() = "Loft 2" Then
		Dim oLoftedFlangeDef As LoftedFlangeDefinition = oFeature.Definition()
		oLoftedFlangeDef.SheetMetalRule=oSmDef.SheetMetalStyles("2,0")
	End If
Next

 

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 3 of 3

RogerdeSmidt
Participant
Participant

Thanks marcin_otręba, your code worked superbly! Much appreciated.