Saltar al contenido

Comentar Imagen

Foto

euler angles


  • Please log in to reply
2 Respuesta(s) a este Tema

#1
sendadiego

sendadiego

    Experto en AuxCAD

  • Miembros
  • 62 Mensajes
  • Auxis: 2

    Buenas tardes,

     

    Estoy haciendo un programilla para controlar un axis system tipo euler angles y estoy atascado porque cuando le doy a grabar macro y la ejecuto siempre inserta uno tipo estandar.

     

    ¿Alguien me puede echar un cable?

    Este es el codigo que utilizo

     

    Sub CATMain()
     
    Dim documents1 As Documents
    Set documents1 = CATIA.Documents
     
    Dim partDocument1 As PartDocument
    Set partDocument1 = documents1.Item("euler.CATPart")
     
    Dim part1 As Part
    Set part1 = partDocument1.Part
     
    Dim axisSystems1 As AxisSystems
    Set axisSystems1 = part1.AxisSystems
     
    Dim axisSystem1 As AxisSystem
    Set axisSystem1 = axisSystems1.Item("Axis System.1")
     
    axisSystem1.Type = catAxisSystemEulerAngles
     
    axisSystem1.OriginType = catAxisSystemOriginByPoint
     
    Dim bodies1 As Bodies
    Set bodies1 = part1.Bodies
     
    Dim body1 As Body
    Set body1 = bodies1.Item("PartBody")
     
    Dim hybridShapes1 As HybridShapes
    Set hybridShapes1 = body1.HybridShapes
     
    Dim hybridShapePointCoord1 As HybridShapePointCoord
    Set hybridShapePointCoord1 = hybridShapes1.Item("Point.1")
     
    Dim reference1 As Reference
    Set reference1 = part1.CreateReferenceFromObject(hybridShapePointCoord1)
     
    axisSystem1.OriginPoint = reference1
     
    axisSystem1.XAxisType = catAxisSystemAxisSameDirection
     
    axisSystem1.YAxisType = catAxisSystemAxisSameDirection
     
    axisSystem1.ZAxisType = catAxisSystemAxisSameDirection
     
    part1.UpdateObject axisSystem1
     
    axisSystem1.IsCurrent = True
     
    part1.Update
     
    Dim settingControllers1 As SettingControllers
    Set settingControllers1 = CATIA.SettingControllers
     
    Dim visualizationSettingAtt1 As VisualizationSettingAtt
    Set visualizationSettingAtt1 = settingControllers1.Item("CATVizVisualizationSettingCtrl")
     
    visualizationSettingAtt1.SaveRepository
     
    End Sub
     

    • 0

    #2
    ferdo

    ferdo

      Experto en AuxCAD

    • Miembros
    • 215 Mensajes
  • Auxis: 104
    • Pais: Country Flag

    Hola

     

    Para inserar un axis system tipo euler angles en CATScript

    Language="VBSCRIPT"
    
    Sub CATMain()
    
    Dim partDocument1 As Document
    Set partDocument1 = CATIA.ActiveDocument
    Dim part1 As Part
    Set part1 = partDocument1.Part
    
    Dim axisSystems1 As AxisSystems
    Set axisSystems1 = part1.AxisSystems
    Dim axisSystem1 As AxisSystem
    Set axisSystem1 = axisSystems1.Add()
    
    axisSystem1.Type = catAxisSystemEulerAngles
    Dim parameters1 As Parameters
    Set parameters1 = part1.Parameters
    str1 = CATIA.ActiveWindow.Name & "\Axis System.2\EulerAngle1"
    Dim angle1 As Parameter
    Set angle1 = parameters1.Item(str1)
    angle1.Value = 45.000000
    
    Dim parameters2 As Parameters
    Set parameters2 = part1.Parameters
    str2 = CATIA.ActiveWindow.Name & "\Axis System.2\EulerAngle2"
    Dim angle2 As Parameter
    Set angle2 = parameters2.Item(str2)
    angle2.Value = 90.000000
    
    axisSystem1.OriginType = catAxisSystemOriginByPoint
    Dim axisSystem2 As AxisSystem
    Set axisSystem2 = axisSystems1.Item("Absolute Axis System")
    Dim reference1 As Reference
    Set reference1 = part1.CreateReferenceFromBRepName("FVertex:(Vertex:(Neighbours:(Face:(Brp:(AxisSystem.1;2);None:();Cf11:());Face:(Brp:(AxisSystem.1;3);None:();Cf11:());Face:(Brp:(AxisSystem.1;1);None:();Cf11:()));Cf11:());WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", axisSystem2)
    
    axisSystem1.OriginPoint = reference1
    axisSystem1.XAxisType = catAxisSystemAxisSameDirection
    axisSystem1.YAxisType = catAxisSystemAxisSameDirection
    axisSystem1.ZAxisType = catAxisSystemAxisSameDirection
    
    part1.UpdateObject axisSystem1
    axisSystem1.IsCurrent = True
    part1.Update 
    
    Dim settingControllers1 As SettingControllers
    Set settingControllers1 = CATIA.SettingControllers
    Dim visualizationSettingAtt1 As SettingController
    Set visualizationSettingAtt1 = settingControllers1.Item("CATVizVisualizationSettingCtrl")
    
    visualizationSettingAtt1.SaveRepository 
    
    End Sub
    
    

    • 3
    Un saludo cordial
    Fernando

    sites visited in RO
    sites visited in EU

    #3
    ferdo

    ferdo

      Experto en AuxCAD

    • Miembros
    • 215 Mensajes
  • Auxis: 104
    • Pais: Country Flag

    Y por un specifico punto y un specifico Geometrical Set...

    Language="VBSCRIPT"
    
    Sub CATMain()
    
    Dim partDocument1 As Document
    Set partDocument1 = CATIA.ActiveDocument
    Dim part1 As Part
    Set part1 = partDocument1.Part
    
    Dim axisSystems1 As AxisSystems
    Set axisSystems1 = part1.AxisSystems
    Dim axisSystem1 As AxisSystem
    Set axisSystem1 = axisSystems1.Add()
    axisSystem1.Type = catAxisSystemEulerAngles
    
    Dim parameters1 As Parameters
    Set parameters1 = part1.Parameters
    str1 = CATIA.ActiveWindow.Name & "\Axis System.2\EulerAngle1"
    Dim angle1 As Parameter
    Set angle1 = parameters1.Item(str1)
    angle1.Value = 45.000000
    
    Dim parameters2 As Parameters
    Set parameters2 = part1.Parameters
    str2 = CATIA.ActiveWindow.Name & "\Axis System.2\EulerAngle2"
    Dim angle2 As Parameter
    Set angle2 = parameters2.Item(str2)
    angle2.Value = 90.000000
    
    Dim parameters3 As Parameters
    Set parameters3 = part1.Parameters
    str3 = CATIA.ActiveWindow.Name & "\Axis System.2\EulerAngle3"
    Dim angle3 As Parameter
    Set angle3 = parameters3.Item(str3)
    angle3.Value = 20.000000
    
    axisSystem1.OriginType = catAxisSystemOriginByPoint
    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 HybridShape
    Set hybridShapePointCoord1 = hybridShapes1.Item("Point.1")
    
    Dim reference1 As Reference
    Set reference1 = part1.CreateReferenceFromObject(hybridShapePointCoord1)
    axisSystem1.OriginPoint = reference1
    
    axisSystem1.XAxisType = catAxisSystemAxisSameDirection
    axisSystem1.YAxisType = catAxisSystemAxisSameDirection
    axisSystem1.ZAxisType = catAxisSystemAxisSameDirection
    part1.UpdateObject axisSystem1
    
    axisSystem1.IsCurrent = True
    part1.Update 
    
    Dim settingControllers1 As SettingControllers
    Set settingControllers1 = CATIA.SettingControllers
    Dim visualizationSettingAtt1 As SettingController
    Set visualizationSettingAtt1 = settingControllers1.Item("CATVizVisualizationSettingCtrl")
    visualizationSettingAtt1.SaveRepository 
    
    End Sub
    
    

    • 3
    Un saludo cordial
    Fernando

    sites visited in RO
    sites visited in EU




    0 Usuario(s) están leyendo este Tema

    0 miembro(s), 0 invitado(s), 0 usuario(s) anónimo(s)