Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to hide/unhide annotations under a specific camera ?

Status
Not open for further replies.

ganeshvivek

New member
Nov 20, 2013
2
IN
I like to hide/unhide all the annotations under specific Camera name("Camera 1").
I want to active a particular camera but i am not sure of exact code.
Kindly help me.

Regards,
Ganesh vivek
 
Replies continue below

Recommended for you

Hi,

Please see the example code.

Sub Main()
Dim partDocument1 As PartDocument
Dim part1 As Part
Dim parameters1 As Parameters
Dim annotationSets1 As AnnotationSets
Dim annotationSet1 As AnnotationSet
Dim annotations1 As Annotations
Dim annotation1 As Annotation
Dim intParam1 As IntParam
Dim oCapture As Capture
Dim selection1 As Selection
Dim name As String
Dim wrkbench As Workbench
Dim name1 As AnyObject
Dim oToleranceZone As ToleranceZone
Dim capture1 As Capture
Set partDocument1 = CATIA.ActiveDocument
Set part1 = partDocument1.Part
Set parameters1 = part1.Parameters
Set annotationSets1 = part1.AnnotationSets
Set annotationSet1 = annotationSets1.Item(1)
partDocument1.Selection.Clear
'Set intParam1 = parameters1.Item("TRIGER")
Dim ID As String
'Dim viewer3D1 As cap
Dim viewpoint3D1 As Viewpoint3D
Dim MyCamera As Camera3D

If annotationSets1.Count > 0 Then
For i = 1 To annotationSet1.Captures.Count
On Error Resume Next
Set oCapture = annotationSet1.Captures.Item(i)
' Set annotation1 = oCapture.Annotations
If Err.Number = 0 Then
Set selection1 = partDocument1.Selection
name = oCapture.name
'selection1.Search "Name=" & name
'intParam1.Value = i
If name = "All Annotations" Then
oCapture.DisplayCapture
Dim Cameras1 As Cameras
Set Cameras1 = partDocument1.Cameras
Count = Cameras1.Count
For j = 1 To Count
Dim Cam As Camera
Set Cam = Cameras1.Item(j)
CamName = Cam.name
If CamName = name Then
Cameras1.Remove (j)
Exit For
End If
Next


'Set oCapture = annotationSet1.CaptureFactory.CreateCapture

Set MyCamera = CATIA.ActiveWindow.ActiveViewer.NewCamera()
MyCamera.Viewpoint3D.Zoom = 0.02
CATIA.ActiveWindow.ActiveViewer.Viewpoint3D = MyCamera.Viewpoint3D
MyCamera.name = name



'************************************************************************************
'this section is where I am trying to active the "tolerancing Capture" workbench to I can Capture the changes on the screen
MyCamera.ActiveCamera
'oCapture.ViewPoint MyCamera
'oCapture.ManageHideShowBody = True
Set annotations1 = annotationSet1.Annotations
annotations1count = annotations1.Count
For l = 1 To annotations1count
Set annotation1 = annotations1.Item(l)
selection1.Add annotation1
Dim visPropertySet1 As VisPropertySet
Set visPropertySet1 = selection1.VisProperties
'
visPropertySet1.SetShow 1
selection1.Clear


selection1.Clear
Next

CATIA.StartCommand "set Current"

CATIA.StartCommand "UnSet Current"
part1.Update
Clear.selection1
End If
Else
Err.Clear
End If
On Error GoTo 0
Next
End If

part1.Update


End Sub

Regards,
Ganesh vivek
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top