Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Below is the code and the image after I've run the code.
I would like to use ilogic to extrude from the top surface using the projected geometry/edges as the profile.
When I try to create extrude feature, I get error. And I'm not sure how to trouble shoot.
Sub Main()
Dim pdoc As PartDocument
pdoc = ThisApplication.ActiveDocument
Dim comDef As PartComponentDefinition
comDef = pdoc.ComponentDefinition
Dim sketches As PlanarSketches
sketches = comDef.Sketches
Dim feats As PartFeatures
feats = comDef.Features
Dim derive As DerivedAssemblyComponents
derive = comDef.ReferenceComponents.DerivedAssemblyComponents
Dim surfaces As SurfaceBody
surfaces = comDef.SurfaceBodies.Item(1)
sketches.Item("TOP_SURFACE").Delete
Dim i As Integer = 1
Dim top(2) As Face
top(0) = Nothing
top(1) = Nothing
Dim n As Integer
n = 1
While i < surfaces.Faces.Count
If surfaces.Faces.Item(i).EdgeLoops.Count > 1 Then
top(n - 1) = surfaces.Faces.Item(i)
n = n + 1
End If
i = i + 1
End While
Dim sketch As PlanarSketch
sketch = sketches.Add(top(1),True)
sketches.Item(1).Name = "TOP_SURFACE"
' Dim profile As Profile
' profile = sketch.Profiles.AddForSurface
' Dim def As ExtrudeDefinition
' def = feats.ExtrudeFeatures.CreateExtrudeDefinition(profile, kJoinOperation)
' feats.ExtrudeFeatures.Add(def)
End Sub
The image below is the desired effect, but it does it automatically through ilogic rule.
Any assistance would be greatly appreciated.
Thank you
Solved! Go to Solution.