Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

3d curve macro recording not working in catia vba

Status
Not open for further replies.

Hadiza Hamza

New member
Dec 15, 2016
6
0
0
NL

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.
 
Replies continue below

Recommended for you

Thanks for the reply. I did as as you advised and checked the file, however, i couldn't find anything. It might also be that i dont kow the exact words to search for. But i did search and check every result that had to with 3D Curve, 3D Spline, Record Macro as well as NURBS creation. However i couldn't find any useful information on them. Do you know any or did you find any? Please i would appreciate the help.
 
if not in v5automation.chm file then it is not available. Freestyle API are not open... if you need them, talk to DS. This is not free, DS will ask for $$$ to make it available to you.

Eric N.
indocti discant et ament meminisse periti
 
@Hadiza Hamza
Have you tried removing the points and re-adding them? Also in your specific scenario could you just recreate the 3D curve?

1-11-2017_5-20-35_PM_ev0w78.jpg


1-11-2017_5-21-22_PM_i28duw.jpg


1-11-2017_5-16-17_PM_aen6px.jpg


Drew Mumaw
 
@drewmumaw

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.
 
@Hadiza Hamza
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:
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 Sub

1-12-2017_6-13-19_PM_txieo4.jpg


1-12-2017_6-09-37_PM_l29zpf.jpg


Drew Mumaw
 
Status
Not open for further replies.
Back
Top