Macro to create a point like button
Macro to create a point like button
(OP)
Hello
I am new on CATIA and i recorded this macro when i created 1 point but now i want that the macro ask me to select the surface and after tell me to click on the surface to create the point (like if i am creating 1 point with CATIA button)
I think that i need to change the red texto and i saw that i can use GetSightDirection but i dont know how.
Can someone help me with this?
Rúben Silva
I am new on CATIA and i recorded this macro when i created 1 point but now i want that the macro ask me to select the surface and after tell me to click on the surface to create the point (like if i am creating 1 point with CATIA button)
I think that i need to change the red texto and i saw that i can use GetSightDirection but i dont know how.
Can someone help me with this?
Rúben Silva
CODE --> V5
Language="VBSCRIPT" Sub CATMain() Set partDocument1 = CATIA.ActiveDocument Set part1 = partDocument1.Part Set hybridShapeFactory1 = part1.HybridShapeFactory Set hybridShapeDirection1 = hybridShapeFactory1.AddNewDirectionByCoord(-0.713634, -0.684806, 0.147534) [/color] Set axisSystems1 = part1.AxisSystems Set axisSystem1 = axisSystems1.Item("axi") Set reference1 = part1.CreateReferenceFromObject(axisSystem1) hybridShapeDirection1.RefAxisSystem = reference1 Set bodies1 = part1.Bodies Set body1 = bodies1.Item("bp50") Set shapes1 = body1.Shapes Set solid1 = shapes1.Item("Solid.106") Set reference2 = part1.CreateReferenceFromBRepName("RSur:(Face:(Brp:(Solid.106;%24);None:();Cf11:());WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", solid1) Set hybridShapePointOnSurface1 = hybridShapeFactory1.AddNewPointOnSurface(reference2, hybridShapeDirection1, 0.000000) Set hybridBodies1 = part1.HybridBodies Set hybridBody1 = hybridBodies1.Item("MACRO_AUXILIAR") hybridBody1.AppendHybridShape hybridShapePointOnSurface1 part1.InWorkObject = hybridShapePointOnSurface1 part1.Update End Sub





RE: Macro to create a point like button
indocti discant et ament meminisse periti
RE: Macro to create a point like button
RE: Macro to create a point like button
indocti discant et ament meminisse periti
RE: Macro to create a point like button
I could create the point/points first but after that i dont know to create a macro to get Normal.
Do you know any other way to get the normal of 1 point\coordenate on surface?
RE: Macro to create a point like button
indocti discant et ament meminisse periti
RE: Macro to create a point like button
RE: Macro to create a point like button
I re read your post and realized you want to create the point on surface after surface selection. if this is the case then have the script select the surface and then start the point function, this will come as point on surface by default as a surface is already selected.
CODE --> vba
Sub CATMain() If CATIA.ActiveDocument.Selection.Count = 1 Then If TypeName(CATIA.ActiveDocument.Selection.Item(1).Value) = "Face" Then CATIA.StartCommand ("Point") End If End If End Subindocti discant et ament meminisse periti