RSilva
Mechanical
- Jun 23, 2017
- 35
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:
Language="VBSCRIPT"
Sub CATMain()
Set partDocument1 = CATIA.ActiveDocument
Set part1 = partDocument1.Part
[COLOR=#EF2929]
Set hybridShapeFactory1 = part1.HybridShapeFactory
Set hybridShapeDirection1 = hybridShapeFactory1.AddNewDirectionByCoord(-0.713634, -0.684806, 0.147534)[/color]
[/color]
Set axisSystems1 = part1.AxisSystems
Set axisSystem1 = axisSystems1.Item("axi")
Set reference1 = part1.CreateReferenceFromObject(axisSystem1)
hybridShapeDirection1.RefAxisSystem = reference1
[COLOR=#EF2929]
Set bodies1 = part1.Bodies
Set body1 = bodies1.Item("bp50")
Set shapes1 = body1.Shapes
Set solid1 = shapes1.Item("Solid.106")
[/color]
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