Hello,
someone knows if there's any chance the CATIA 3-point ARC is available to be created with VBA / VB.NET?
I am having trouble finding it within documentation, if exists...
Thanks!
Mladen
Which feature? 3 point arc inside a sketch? Or circle through three points from the GSD workbench?
GSD Workbench is easy:
HybridShappeFactory -> addnewcircle3Points (HybridShapeCircle3Points)
Func AddNewCircle3Points( Reference iPoint1, Reference iPoint2, Reference iPoint3) As HybridShapeCircle3Points
Inside a sketch, it's a bit trickier. The CreateCircle method in Factory2D does allow you to specify start and end points of the circle - making it an arc. But you would need to compute them ahead of time or close enough start and end points and then constrain them to the points you wanted to use to build your arc through.
Func CreateCircle( double iCenterX, double iCenterY, double iRadius, double iStartParam, double iEndParam) As Circle2D
Hi Josh, thanks for your answer!
Yes, for the GSD - in the 3D space, but, isn't the addnewcircle3Points one for creating the full circle? (haven't tried it yet)
So for getting only an arc, I guess, it should take also to cut it with the first and last point, or so...?
But then I would need to automatically decide on the side to cut and this complicates things "a bit" :)
No. It's naturally an arc. Don't forget, the CATIA command for an arc through 3 points is labeled as "Circle Definition". The VBA object name will always be similar to the commands.
If you wanted to make it a complete circle, you'd have to create another object called hybridshapecircle. Then you could change limit to whole.
Here is an example. I create 3 points on the XY plane in an empty body:
Sub CATMain()
Dim PD As PartDocument
Set PD = CATIA.ActiveDocument
Dim R1, R2, R3
Dim P As Part
Set P = PD.Part
Dim HSF As HybridShapeFactory
Set HSF = P.HybridShapeFactory
Dim HB As HybridBody
Set HB = P.HybridBodies.Item(1)
Set R1 = P.CreateReferenceFromObject(HB.HybridShapes.Item(1))
Set R2 = P.CreateReferenceFromObject(HB.HybridShapes.Item(2))
Set R3 = P.CreateReferenceFromObject(HB.HybridShapes.Item(3))
Dim A As HybridShapeCircle3Points
Set A = HSF.AddNewCircle3Points(R1, R2, R3)
HB.AppendHybridShape A
P.Update
Dim B As HybridShapeCircle
Set B = A
B.SetLimitation 1
P.Update
End Sub
Oh, I get it - thank you so much Josh for thorough explanation.
So, you access the managing parameters as with the HybridShapeCircle object...excellent!
Cheers!