Aviatorbarath
New member
Hi I need to create a Camera view in the first quadrant (1.e XY plane with both x and y facing positive direction) with respect to LOCAL COORDINATE i.e new cooordinate system
Any Suggestions will be helpful..
I used the following code but it gives the results wrt to global coordinate doesnt work with local new coordinate which i created..even though i activated the local axis system...
' To define a Local Axis system ......................................................................................
Set axisSystems1 = part1.AxisSystems
Set axisSystem1 = axisSystems1.Add()
axisSystem1.OriginType = catAxisSystemOriginByPoint
axisSystem1.OriginPoint = reference2
axisSystem1.XAxisType = catAxisSystemAxisSameDirection
Set reference7 = part1.CreateReferenceFromObject(hybridShapeLinePtPt1)
axisSystem1.XAxisDirection = reference7
axisSystem1.YAxisType = catAxisSystemAxisSameDirection
Set reference8 = part1.CreateReferenceFromObject(hybridShapeLinePtPt2)
axisSystem1.YAxisDirection = reference8
axisSystem1.ZAxisType = catAxisSystemAxisSameDirection
Set reference15 = part1.CreateReferenceFromObject(hybridShapeLineNormal1)
axisSystem1.ZAxisDirection = reference15
part1.UpdateObject axisSystem1
axisSystem1.IsCurrent = True
part1.Update
Set settingControllers1 = CATIA.SettingControllers
Set visualizationSettingAtt1 = settingControllers1.Item("CATVizVisualizationSettingCtrl")
visualizationSettingAtt1.SaveRepository
Dim specsAndGeomWindow1 As SpecsAndGeomWindow
Set specsAndGeomWindow1 = CATIA.ActiveWindow
Dim viewer3D1 As viewer3D
Set viewer3D1 = specsAndGeomWindow1.ActiveViewer
Dim camera3D1 As Camera3D
Set camera3D1 = viewer3D1.NewCamera()
Dim viewpoint3D1 As viewpoint3D
Set viewpoint3D1 = camera3D1.viewpoint3D
viewer3D1.viewpoint3D = viewpoint3D1
Set viewpoint3D1 = camera3D1.viewpoint3D
viewer3D1.viewpoint3D = viewpoint3D1
Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.ActiveDocument
Dim cameras1 As Cameras
Set cameras1 = partDocument1.Cameras
' Get the viewer...........................................................................................................................
Dim oViewer
Set oViewer = CATIA.ActiveWindow.ActiveViewer
' Get the viewpoint........................................................................................................................
Dim oViewpoint
Set oViewpoint = oViewer.viewpoint3D
' Get the current parameters................................................................................................................
Dim Origin(2)
oViewpoint.GetOrigin Origin
MsgBox "" & Origin(0) & " , " & Origin(1) & " , " & Origin(2)
Dim SightDirection(2)
oViewpoint.GetSightDirection SightDirection
MsgBox "" & SightDirection(0) & " , " & SightDirection(1) & " , " & SightDirection(2)
Dim UpDirection(2)
oViewpoint.GetUpDirection UpDirection
MsgBox "" & UpDirection(0) & " , " & UpDirection(1) & " , " & UpDirection(2)
Dim Focus
Focus = oViewpoint.FocusDistance
' Change the viewpoint........................................................................................................................
Dim StdSightDirection(2)
Dim StdUpDirection(2)
StdSightDirection(0) = 0
StdSightDirection(1) = 0
StdSightDirection(2) = -1
StdUpDirection(0) = 0
StdUpDirection(1) = 1
StdUpDirection(2) = 0
Dim i
For i = 0 To 2
Origin(i) = Origin(i) + Focus * (SightDirection(i) - StdSightDirection(i))
Next
oViewpoint.PutOrigin Origin
oViewpoint.PutSightDirection StdSightDirection
oViewpoint.PutUpDirection StdUpDirection
oViewpoint.ProjectionMode = catProjectionCylindric
' Update the viewer............................................................................................................................
oViewer.Update
Set oViewpoint = Nothing
Set oViewer = Nothing
Set specsAndGeomWindow1 = CATIA.ActiveWindow
Dim viewer3D
Set viewer3D = specsAndGeomWindow1.ActiveViewer
Dim viewpoint3D
Set viewpoint3D = viewer3D.viewpoint3D
CATIA.StartCommand ("Collapse all")
Please suggest useful tips to proceed further
Regards
Barath
Any Suggestions will be helpful..
I used the following code but it gives the results wrt to global coordinate doesnt work with local new coordinate which i created..even though i activated the local axis system...
' To define a Local Axis system ......................................................................................
Set axisSystems1 = part1.AxisSystems
Set axisSystem1 = axisSystems1.Add()
axisSystem1.OriginType = catAxisSystemOriginByPoint
axisSystem1.OriginPoint = reference2
axisSystem1.XAxisType = catAxisSystemAxisSameDirection
Set reference7 = part1.CreateReferenceFromObject(hybridShapeLinePtPt1)
axisSystem1.XAxisDirection = reference7
axisSystem1.YAxisType = catAxisSystemAxisSameDirection
Set reference8 = part1.CreateReferenceFromObject(hybridShapeLinePtPt2)
axisSystem1.YAxisDirection = reference8
axisSystem1.ZAxisType = catAxisSystemAxisSameDirection
Set reference15 = part1.CreateReferenceFromObject(hybridShapeLineNormal1)
axisSystem1.ZAxisDirection = reference15
part1.UpdateObject axisSystem1
axisSystem1.IsCurrent = True
part1.Update
Set settingControllers1 = CATIA.SettingControllers
Set visualizationSettingAtt1 = settingControllers1.Item("CATVizVisualizationSettingCtrl")
visualizationSettingAtt1.SaveRepository
Dim specsAndGeomWindow1 As SpecsAndGeomWindow
Set specsAndGeomWindow1 = CATIA.ActiveWindow
Dim viewer3D1 As viewer3D
Set viewer3D1 = specsAndGeomWindow1.ActiveViewer
Dim camera3D1 As Camera3D
Set camera3D1 = viewer3D1.NewCamera()
Dim viewpoint3D1 As viewpoint3D
Set viewpoint3D1 = camera3D1.viewpoint3D
viewer3D1.viewpoint3D = viewpoint3D1
Set viewpoint3D1 = camera3D1.viewpoint3D
viewer3D1.viewpoint3D = viewpoint3D1
Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.ActiveDocument
Dim cameras1 As Cameras
Set cameras1 = partDocument1.Cameras
' Get the viewer...........................................................................................................................
Dim oViewer
Set oViewer = CATIA.ActiveWindow.ActiveViewer
' Get the viewpoint........................................................................................................................
Dim oViewpoint
Set oViewpoint = oViewer.viewpoint3D
' Get the current parameters................................................................................................................
Dim Origin(2)
oViewpoint.GetOrigin Origin
MsgBox "" & Origin(0) & " , " & Origin(1) & " , " & Origin(2)
Dim SightDirection(2)
oViewpoint.GetSightDirection SightDirection
MsgBox "" & SightDirection(0) & " , " & SightDirection(1) & " , " & SightDirection(2)
Dim UpDirection(2)
oViewpoint.GetUpDirection UpDirection
MsgBox "" & UpDirection(0) & " , " & UpDirection(1) & " , " & UpDirection(2)
Dim Focus
Focus = oViewpoint.FocusDistance
' Change the viewpoint........................................................................................................................
Dim StdSightDirection(2)
Dim StdUpDirection(2)
StdSightDirection(0) = 0
StdSightDirection(1) = 0
StdSightDirection(2) = -1
StdUpDirection(0) = 0
StdUpDirection(1) = 1
StdUpDirection(2) = 0
Dim i
For i = 0 To 2
Origin(i) = Origin(i) + Focus * (SightDirection(i) - StdSightDirection(i))
Next
oViewpoint.PutOrigin Origin
oViewpoint.PutSightDirection StdSightDirection
oViewpoint.PutUpDirection StdUpDirection
oViewpoint.ProjectionMode = catProjectionCylindric
' Update the viewer............................................................................................................................
oViewer.Update
Set oViewpoint = Nothing
Set oViewer = Nothing
Set specsAndGeomWindow1 = CATIA.ActiveWindow
Dim viewer3D
Set viewer3D = specsAndGeomWindow1.ActiveViewer
Dim viewpoint3D
Set viewpoint3D = viewer3D.viewpoint3D
CATIA.StartCommand ("Collapse all")
Please suggest useful tips to proceed further
Regards
Barath