Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Ilogic Extrusion from Derived Part

Anonymous

Ilogic Extrusion from Derived Part

Anonymous
Not applicable

I'm trying to create an extruded cut 'through all' from a sketch that I have included from a derived part however the sketch is not recognised as a profile when calling the extrude feature in iLogic. All my search results thus far have been referencing extrusions in standard parts but I imagine that my problem would be very common to skeletal modelling when coupled with iLogic...

 

I have attached my model with the code in question

 

Apologies in advance for some potentially horrendous code, I'm still very much a beginner and at the copy from forum to ilogic rule stage and repeat as required :slightly_smiling_face: Any help would be much appreciated.

 

'Prompt for user form
'iLogicForm.Show("Create Wedge Type Sideliner")

'set a reference to the setup sideliner component definintion.
'this assumes a part document is open.
Dim oPartCompDef As PartComponentDefinition
oPartCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'define the path and file name
Dim sPathandName As String
sPathandName  = ThisDoc.PathAndFileName(False)

' Create a new part file to derive the selected part into 
'note: kPartDocumentObject is the default template
'you could specify a path and file name for a custom template
Dim oPartDoc As PartDocument
oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject)) 


'create the derived setup sideliner part definition

Dim oDerivedPartDef As DerivedPartDefinition 
oDerivedPartDef = oPartDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.CreateDefinition(sPathandName & ".ipt")

'Set derive style options

oDerivedPartDef.DeriveStyle = DerivedComponentStyleEnum.kDeriveAsSingleBodyWithSeams
'options:
	'kDeriveAsSingleBodyWithSeams 
	'kDeriveAsSingleBodyNoSeams 
	'kDeriveAsMultipleBodies 
	'kDeriveAsWorkSurface 

'Create the derived part
Dim oDerivedPart As DerivedPartComponent 
'MsgBox(sPathandName)
oDerivedPart = oPartDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.Add(oDerivedPartDef)

Dim oDerivedPartComp As DerivedPartComponent
oDerivedPartComp = oPartDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents(1)

Dim oDerivedPartDef_2 As DerivedPartUniformScaleDef
oDerivedPartDef_2 = oDerivedPartComp.Definition

Dim oDerEntity As DerivedPartEntity
Dim oProfile As Profile
For Each oDerEntity In oDerivedPartDef_2.Sketches
If (oDerEntity.ReferencedEntity.Name = "final_sideliner_height_mod") Then
oDerEntity.IncludeEntity = True
'MsgBox("found it")
Exit For
End If
Next

Dim oSketch As DerivedPartEntity
oSketch = oDerivedPartDef_2.Sketches("final_sideliner_height_mod")


'***THIS {PART HERE IS NOT WORKING FOR DERIVED PART SKETCH AS PROFILE LOOP IN THE EXTRUSION BELOW
'oProfile = oSketch.AddForSolid


'Set Definition back, so DerivedPart Document is updated
oDerivedPartComp.Definition = oDerivedPartDef_2

Dim oPartCompDef_2 As PartComponentDefinition
oPartCompDef_2 = ThisApplication.ActiveDocument.ComponentDefinition

'Modify the Derived Setup Sideliner into the Final Geometry
'Step 1 - Adjust the height:

' Create an extrusion 
Dim oExtrude As ExtrudeFeature
oExtrude = oPartCompDef_2.Features.ExtrudeFeatures.AddByDistanceExtent(oSketch,1000,kSymmetric,kCutOperation)

iLogicVb.UpdateWhenDone = True
0 Likes
Reply
514 Views
0 Replies
Replies (0)