Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am looking to add a If or Case statement to some code. It updates the label name for all drawing views on a sheet but I would like it to only overwrite standard view names and numbers as that is what the view labels default to.
I cant seem to do it by converting the string to a double as actual text cant seem to be converted and if it converts all text to a number than the custom values I don't want it to change will be overwritten.
Does anyone have a solution for this? I've put the code I have below.
'[ ASSEMBLY OR PART oView = ActiveSheet.DrawingViews.NativeEntity.Item(1) oRDD = oView.ReferencedDocumentDescriptor Dim oModelType As String If oRDD.ReferencedDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then oModelType = "Assembly" ElseIf oRDD.ReferencedDocumentType = DocumentTypeEnum.kPartDocumentObject Then oModelType = "Part" End If '] '[ VIEW SELECTOR Dim tmpSheet As Sheet = ThisDrawing.ActiveSheet.Sheet Dim tmpView As DrawingView For Each tmpView In tmpSheet.DrawingViews Dim myDrawingViewName As String = "" If tmpView.Type = ObjectTypeEnum.kDrawingViewObject Then 'Encapsulat the rotation of drawing view in a transaction Dim oTrans As Transaction oTrans = ThisApplication.TransactionManager.StartTransaction(ThisDrawing.Document, "Rotate Drawing View temp") ' Set rotation to 0 If tmpView.Camera.ViewOrientationType = ViewOrientationTypeEnum.kArbitraryViewOrientation Then If tmpView.Rotation<>0 Then tmpView.Rotation = 0 End If End If Dim MyDrawingViewNameNUM As Double = tmpView.Name '] '[ CASE SELECTOR Select Case tmpView.Name Case "BACK", "BOTTOM", "FRONT", "SIDE", "TOP", "O/S FACE", "I/S FACE", "END", MyDrawingViewNameNUM <2000 '] '[ PART VIEW LABELS If oModelType = "Assembly" Select Case tmpView.Camera.ViewOrientationType Case ViewOrientationTypeEnum.kBackViewOrientation myDrawingViewName = "BACK" Case ViewOrientationTypeEnum.kBottomViewOrientation myDrawingViewName = "BOTTOM" Case ViewOrientationTypeEnum.kFrontViewOrientation myDrawingViewName = "FRONT" Case ViewOrientationTypeEnum.kIsoBottomLeftViewOrientation myDrawingViewName = "ISOMETRIC" Case ViewOrientationTypeEnum.kIsoBottomRightViewOrientation myDrawingViewName = "ISOMETRIC" Case ViewOrientationTypeEnum.kIsoTopLeftViewOrientation myDrawingViewName = "ISOMETRIC" Case ViewOrientationTypeEnum.kIsoTopRightViewOrientation myDrawingViewName = "ISOMETRIC" Case ViewOrientationTypeEnum.kLeftViewOrientation myDrawingViewName = "SIDE" Case ViewOrientationTypeEnum.kRightViewOrientation myDrawingViewName = "SIDE" Case ViewOrientationTypeEnum.kTopViewOrientation myDrawingViewName = "TOP" Case Else myDrawingViewName = "" End Select If Not myDrawingViewName = "" Then tmpView.Name = myDrawingViewName End If myDrawingViewName = "" End If '] '[ PART VIEW LABELS If oModelType = "Part" Select Case tmpView.Camera.ViewOrientationType Case ViewOrientationTypeEnum.kBackViewOrientation myDrawingViewName = "O/S FACE" Case ViewOrientationTypeEnum.kBottomViewOrientation myDrawingViewName = "BOTTOM" Case ViewOrientationTypeEnum.kFrontViewOrientation myDrawingViewName = "I/S FACE" Case ViewOrientationTypeEnum.kIsoBottomLeftViewOrientation myDrawingViewName = "" Case ViewOrientationTypeEnum.kIsoBottomRightViewOrientation myDrawingViewName = "" Case ViewOrientationTypeEnum.kIsoTopLeftViewOrientation myDrawingViewName = "" Case ViewOrientationTypeEnum.kIsoTopRightViewOrientation myDrawingViewName = "" Case ViewOrientationTypeEnum.kLeftViewOrientation myDrawingViewName = "END" Case ViewOrientationTypeEnum.kRightViewOrientation myDrawingViewName = "END" Case ViewOrientationTypeEnum.kTopViewOrientation myDrawingViewName = "TOP" Case Else myDrawingViewName = "" End Select If Not myDrawingViewName = "" Then tmpView.Name = myDrawingViewName End If myDrawingViewName = "" End If '] End Select End If Next
Solved! Go to Solution.