3d curve macro recording not working in catia vba
3d curve macro recording not working in catia vba
(OP)
i have been trying to record the creation of a 3d curve using control points in catia using the macro recorder but it refuses to record anything except part.update. I even tried it in both Freestyle workbench and Digitized shape editor workbench, but both have same result. please could someone explain to me how to do it or atleast where i could find such macro.





RE: 3d curve macro recording not working in catia vba
indocti discant et ament meminisse periti
RE: 3d curve macro recording not working in catia vba
RE: 3d curve macro recording not working in catia vba
indocti discant et ament meminisse periti
RE: 3d curve macro recording not working in catia vba
Have you tried removing the points and re-adding them? Also in your specific scenario could you just recreate the 3D curve?
Drew Mumaw
www.textsketcher.com
www.drewmumaw.com
RE: 3d curve macro recording not working in catia vba
I am not trying to create a normal 2D spline which one can use the addNewSpline method for, but the 3D Curve which uses control points to guide its path. I have checked the object browser and it is not part of the index. I was told that when it is not in the Object browser that it could not be automated. I have also seen it being discussed as one of the features of catia that could only be automated using CAA RADE.
RE: 3d curve macro recording not working in catia vba
indocti discant et ament meminisse periti
RE: 3d curve macro recording not working in catia vba
AddNewSpline() can create a 3D curve if you use non-planar points. See code below that uses 3 points to create a 3D curve (in this example I already created 3 points in a geometrical set in CATIA, but you could create them in your own script to make it fully automated).
CODE --> catvba
Sub CATMain() Dim partDocument1 As PartDocument Set partDocument1 = CATIA.ActiveDocument Dim part1 As Part Set part1 = partDocument1.Part Dim hybridShapeFactory1 As HybridShapeFactory Set hybridShapeFactory1 = part1.HybridShapeFactory Dim hybridShapeSpline1 As HybridShapeSpline Set hybridShapeSpline1 = hybridShapeFactory1.AddNewSpline() hybridShapeSpline1.SetSplineType 0 hybridShapeSpline1.SetClosing 0 Dim hybridBodies1 As HybridBodies Set hybridBodies1 = part1.HybridBodies Dim hybridBody1 As HybridBody Set hybridBody1 = hybridBodies1.Item("Geometrical Set.1") Dim hybridShapes1 As HybridShapes Set hybridShapes1 = hybridBody1.HybridShapes Dim hybridShapePointCoord1 As HybridShapePointCoord Set hybridShapePointCoord1 = hybridShapes1.Item("Point.1") Dim reference1 As Reference Set reference1 = part1.CreateReferenceFromObject(hybridShapePointCoord1) hybridShapeSpline1.AddPointWithConstraintExplicit reference1, Nothing, -1#, 1, Nothing, 0# Dim hybridShapePointCoord2 As HybridShapePointCoord Set hybridShapePointCoord2 = hybridShapes1.Item("Point.2") Dim reference2 As Reference Set reference2 = part1.CreateReferenceFromObject(hybridShapePointCoord2) hybridShapeSpline1.AddPointWithConstraintExplicit reference2, Nothing, -1#, 1, Nothing, 0# Dim hybridShapePointCoord3 As HybridShapePointCoord Set hybridShapePointCoord3 = hybridShapes1.Item("Point.3") Dim reference3 As Reference Set reference3 = part1.CreateReferenceFromObject(hybridShapePointCoord3) hybridShapeSpline1.AddPointWithConstraintExplicit reference3, Nothing, -1#, 1, Nothing, 0# hybridBody1.AppendHybridShape hybridShapeSpline1 part1.InWorkObject = hybridShapeSpline1 part1.Update End SubDrew Mumaw
www.textsketcher.com
www.drewmumaw.com