origin
origin
(OP)
hello everybody!
I tried to create a macro that give me the origin of a selected cercle!
i tried this one but it gives wrong values!
I tried to create a macro that give me the origin of a selected cercle!
CODE -->
MsgBox "selectionnez un trou" Dim InputObjectType(0), Status1 InputObjectType(0)="Hole" Status1=selection1.SelectElement2(InputObjectType,"Select un trou",false) If Status1 = "Cancel" Then selection1.Clear: Exit Sub Dim reference1 As Reference Set oHole = selection1.Item(1).value '************************Origine du trou******************************** 'get the origin of the hole using the variant object Dim origin(2) oHole.GetOrigin (origin) Msgbox "Origin = " & origin(0) & ", " & origin(1) & ", " & origin(2) '******************************************************************





RE: origin
For many of your questions you can find an answer in CATIA_Portable_Script_Center or directly here in forum. Please use search function to get a quicker answer.
For this question you can find the answer in Part sub chapter in CATIA_Portable_Script_Center.
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: origin
CODE -->
Sub origin() Set oDocument = CATIA.ActiveDocument Set oHole = oDocument.Selection.FindObject("CATIAHole") Dim origin(2) oHole.GetOrigin origin MsgBox "Origin = " & origin(0) / 25.4 & ", " & origin(1) / 25.4 & ", " & origin(2) / 25.4 End SubRE: origin
the hole is already selected! but what "25.4" refers to?
after all, the values still wrong :(
RE: origin
indocti discant et ament meminisse periti