02-01-2017
04:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
02-01-2017
04:44 AM
Alright, here you go. The rule will now only process the selected views on the active sheet and only if the source model is a sheet metal (that's the document type check).
Dim oDoc As Document = ThisApplication.ActiveDocument
If oDoc.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub
Dim oView As DrawingView
Dim oSSet As SelectSet = ThisDoc.Document.SelectSet
If oSSet.count = 0 Then
MessageBox.Show("Select view(s)", "Attention!")
Exit Sub
End If
Dim oSheet As Sheet = oDoc.ActiveSheet
If oSheet.DrawingViews.Count = 0 Then Continue For
For Each oView In oSSet
Dim oModel As Document = oView.ReferencedDocumentDescriptor.ReferencedDocument
If oModel.DocumentSubType.DocumentSubTypeID <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Continue For
Dim oOptions As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
oOptions.Add("SheetMetalFoldedModel", False)
Dim oPoint As Point2D = oView.Position
Dim oViewStyle As DrawingViewStyleEnum = oView.ViewStyle
Dim oScale As Double = oView.Scale
Dim oOri As ViewOrientationTypeEnum = ViewOrientationTypeEnum.kDefaultViewOrientation
oSheet.DrawingViews.AddBaseView(oModel, oPoint, oScale, oOri, oViewStyle, , , oOptions)
oView.Delete()
Next
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
- - - - - - - - - - - - - - -
Regards,
Mike
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods