Reply
Solved! Go to solution

Modifying 4 chamfers with Visual Basic

I'm new to working with SE with Visual Basic and the forum. I have made a part file of a simple tube with 4 sharp edges. I can add chamfer with VB on all the edges. My issue is I need 4 different sized chamfers. I can not see how to change the chamfer with different values. I've worked on this for Day 2 and think it's time ask for some advice.  

 

Thanks in Advance 

 

Dim SE As SolidEdgeFramework.Application
Dim Model As Model
Dim ExtProt As ExtrudedProtrusion
Dim Edgs As Edges
Dim EdgArr(0 To 3) As Edge
Dim Chamfer As SolidEdgePart.Chamfer

SE = GetObject(, "solidedge.application")
Model = SE.ActiveDocument.models.item(1)
ExtProt = Model.ExtrudedProtrusions.Item(1)
Edgs = ExtProt.Edges(EdgeType:=SolidEdgeGeometry.FeatureTopologyQueryTypeConstants.igQueryAll)


EdgArr(0) = Edgs.Item(1)
EdgArr(1) = Edgs.Item(2)
EdgArr(2) = Edgs.Item(3)
EdgArr(3) = Edgs.Item(4)

Chamfer = Model.Chamfers.AddEqualSetback(NumberOfEdgeSets:=4, EdgeSetArray:=EdgArr, SetbackDistance:=0.001)

6 REPLIES

Re: Modifying 4 chamfers with Visual Basic

Hi @LenC,

you nees 4 different chamfer objeccts. A Chamfer object the references 4 edges will change all to the same value.

Additional you have to create new chamfer objects if you like to change from equal setback to  one of the other types (see ChamferType value).

You also cannot change the type in the UI of Solid Edge.

If you have a equal setback Chamfer the only  value you can change is ChamferSetbackValue1.

regards

JB
VS2015, SE ST10

Re: Modifying 4 chamfers with Visual Basic

@JB

 

Thank you for the advice.

 

I think I am creating a object correctly but the computer is telling me otherwise. I  error at chamfer1.ChamferSetbackValue1 = 0.001. I Dim and tie Chamfer1 to Chamfers.Item(1). I do not understand am I not creating Chamfer1 correctly. The Chamfer is named chamfer 1  on the model.

 

 

Dim chamfer1 As SolidEdgePart.Chamfer = Nothing

 chamfer1 = model.Chamfers.Item(1)

'chamfer1.ChamferSetbackValue1 = 0.001

Re: Modifying 4 chamfers with Visual Basic

Hi could you share your SE file?
What version of SE are you using?
regards

JB
VS2015, SE ST10

Re: Modifying 4 chamfers with Visual Basic

@JB

 

I'm using ST8. 

Solution
Solution
Accepted by topic author LenC
‎07-22-2017 08:51 PM

Re: Modifying 4 chamfers with Visual Basic

[ Edited ]

Hi, I opened your part.
You have created the chamfers in synchronous mode. So they cannot be modified the way you like.
Change mode to ordered

partDocument.ModellingMode = seModelingModeOrdered

before you add  the chamfers, or even before you create the ring body if you like.

regards

JB
VS2015, SE ST10

Re: Modifying 4 chamfers with Visual Basic

Thanks, That was a big Help