- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Adding / projecting back view
Hey
I have a method that is adding a base view to a sheet. I need to add the opposite / back view of the current view either as a separate view or projected but cant figure it out.
Anyone know a way of doing that?
Thanks
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
this iLogic rule uses the first DrawingView on the sheet to create the back view (and rightview but that will be deleted automaticaly.)
Dim doc As DrawingDocument = ThisApplication.ActiveDocument Dim oSheet As Sheet = doc.ActiveSheet Dim baseView As DrawingView = oSheet.DrawingViews.Item(1) Dim oTG As TransientGeometry = ThisApplication.TransientGeometry Dim baseViewPosition As Point2d = baseView.Position Dim BaseViewWidth As Double = baseView.Width Dim rightViewPosition As Point2d = oTG.CreatePoint2d(baseViewPosition.X + 1 + BaseViewWidth / 2, baseViewPosition.Y) Dim backViewPosition As Point2d = oTG.CreatePoint2d(baseViewPosition.X + 1 + BaseViewWidth, baseViewPosition.Y) Dim drawingViewStyle As DrawingViewStyleEnum = DrawingViewStyleEnum.kFromBaseDrawingViewStyle Dim rightView As DrawingView = oSheet.DrawingViews.AddProjectedView(baseView, rightViewPosition, drawingViewStyle) Dim backView As DrawingView = oSheet.DrawingViews.AddProjectedView(rightView, backViewPosition, drawingViewStyle) 'the right view was created to create the back view but is not what you asked for, therfor it can be deleted rightView.Delete() ' this line is not mandatory but make makes sure that the views stay aligned backView.Align(baseView, DrawingViewAlignmentEnum.kHorizontalViewAlignment)
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I tried another way. This code will create an opposite view directly.
Option Explicit
Sub CreateOppositeView()
Dim oDrawingDoc As DrawingDocument
Set oDrawingDoc = ThisApplication.ActiveDocument
Dim oSourceView As DrawingView
Set oSourceView = oDrawingDoc.ActiveSheet.DrawingViews(1)
' Document
Dim oSourceDoc As Document
Set oSourceDoc = oSourceView.ReferencedDocumentDescriptor.ReferencedDocument
' Position
Dim oViewPosition As Point2d
Set oViewPosition = oSourceView.Position.Copy
oViewPosition.X = oViewPosition.X + oSourceView.Width + 1
' Scale
Dim viewScale As Double
viewScale = oSourceView.Scale
' ViewStyle
Dim viewStyle As DrawingViewStyleEnum
viewStyle = oSourceView.viewStyle
' ModelViewName
Dim modelViewName As String
modelViewName = oSourceView.ActiveDesignViewRepresentation
' Camera
Dim oCamera As Camera
Set oCamera = ThisApplication.TransientObjects.CreateCamera
oCamera.Eye = GetOppositeEyePoint(oSourceView.Camera)
oCamera.Target = oSourceView.Camera.Target
oCamera.UpVector = oSourceView.Camera.UpVector
' Create new DrawingView
Dim oNewDrawingView As DrawingView
Set oNewDrawingView = oDrawingDoc.ActiveSheet.DrawingViews.AddBaseView(oSourceDoc, oViewPosition, viewScale, kArbitraryViewOrientation, viewStyle, modelViewName, oCamera)
End Sub
Function GetOppositeEyePoint(oCamera As Camera) As Point
Dim X As Double
Dim Y As Double
Dim Z As Double
X = oCamera.Target.X * 2 - oCamera.Eye.X
Y = oCamera.Target.Y * 2 - oCamera.Eye.Y
Z = oCamera.Target.Z * 2 - oCamera.Eye.Z
Set GetOppositeEyePoint = ThisApplication.TransientGeometry.CreatePoint(X, Y, Z)
End Function=====
Freeradical
Hideo Yamada