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!

Searching for FrontView Scale

Status
Not open for further replies.

LucasC

Automotive
Feb 18, 2019
157
Need a hand sorting out a do until loop. Any suggestions for a better method welcome.

My goal is to search all the views on the active sheet until I find the FrontView TYPE(not the name of the view as these can change). I'm choosing to target the front view type due to the sheet scale using its value in most cases. It's ultimately up to the designer to verify this information is correct.

My thought was to loop through all the views until CatDrawingViewType catViewFront was found, add that to the selection and pull the scale value. When I set the selection, the scale property is not available in the intellisense.

Code:
Dim drawingDocument1 As DrawingDocument
Set drawingDocument1 = CATIA.ActiveDocument

'Look for Front View Scale Value
Dim ViewCount As Integer
Set ViewCount = drawingDocument1.sheets.ActiveSheet.views.Count

Dim FrontView As String
Set FrontView = drawingDocument1.sheets.ActiveSheet.views
Loop Until FrontView = CatDrawingViewType("catViewFront")

Dim ViewSel As selection
Set ViewSel = FrontView

Dim SheetScale
Set SheetScale = ViewSel[highlight #FCE94F].???[/highlight]
 
Replies continue below

Recommended for you

ViewSel is a Selection... if you want intellisens to give you Scale.. please Set ViewSel as DrawingView

Eric N.
indocti discant et ament meminisse periti
 
My code was completely wrong, but your suggestion gave me the clue i needed to make it work. thanks!

Code:
Dim drawingDocument1 As DrawingDocument
Set drawingDocument1 = CATIA.ActiveDocument

'Look for Front View Scale Value
Dim FrontView As CatDrawingViewType
Do
Dim n
n = n + 1
FrontView = drawingDocument1.sheets.ActiveSheet.views.Item(n).ViewType
Loop Until FrontView = catViewFront

'add error-proofing for sheets without frontview type

drawingDocument1.sheets.ActiveSheet.views.Item(n).Activate

Dim ViewSel As DrawingView
Set ViewSel = drawingDocument1.sheets.ActiveSheet.views.ActiveView

Dim ViewScale
ViewScale = ViewSel.Scale

'verify value passing thru
MsgBox ViewScale
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor