iLogic sculpt - CreateObjectCollection for workplane

iLogic sculpt - CreateObjectCollection for workplane

Anonymous
Not applicable
728 Views
1 Reply
Message 1 of 2

iLogic sculpt - CreateObjectCollection for workplane

Anonymous
Not applicable

Need help to create a sculpt feature.

I would like to use 2 or more workplane (using their names) but dont know how to make a collection of workplanes. The code below only works for one.

 

'reference to the part document
Dim oDoc As Document = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition

'List of work planes to use
Dim xyPlane As WorkPlane = oDef.WorkPlanes.Item("XY Plane")
Dim yzPlane As WorkPlane = oDef.WorkPlanes.Item("XY Plane")

'features collection
Dim oFeatures As PartFeatures = oDef.Features

'surfaces collection
Dim oSurfaces As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection()
'For Each osurface As WorkSurface In oDef.WorkSurfaces
'	oSurfaces.Add(oFeatures.SculptFeatures.CreateSculptSurface(osurface, PartFeatureExtentDirectionEnum.kNegativeExtentDirection))
'Next

oSurfaces.Add(oFeatures.SculptFeatures.CreateSculptSurface(yzPlane, PartFeatureExtentDirectionEnum.kNegativeExtentDirection))

'create sculpt feature
Dim oSculpt As SculptFeature = oFeatures.SculptFeatures.Add(oSurfaces, PartFeatureOperationEnum.kCutOperation)
 
iLogic_Sculpt.JPG

 

 

0 Likes
Accepted solutions (1)
729 Views
1 Reply
Reply (1)
Message 2 of 2

JhoelForshav
Mentor
Mentor
Accepted solution

Hi @Anonymous 

This works fine for me on your attached ipt 🙂

 

'reference to the part document
Dim oDoc As Document = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition

'List of work planes to use
Dim xyPlane As WorkPlane = oDef.WorkPlanes.Item("XY Plane")
Dim yzPlane As WorkPlane = oDef.WorkPlanes.Item("XY Plane")



'features collection
Dim oFeatures As PartFeatures = oDef.Features

'surfaces collection
Dim oSurfaces As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection()

oSurfaces.Add(oFeatures.SculptFeatures.CreateSculptSurface(xyPlane, PartFeatureExtentDirectionEnum.kNegativeExtentDirection))
oSurfaces.Add(oFeatures.SculptFeatures.CreateSculptSurface(yzPlane, PartFeatureExtentDirectionEnum.kNegativeExtentDirection))

oFeatures.SculptFeatures.Add(oSurfaces, PartFeatureOperationEnum.kCutOperation)