Unfortunately I would not have the time to work on this independently and feel other users can offer more experienced advice. It would be best to supply a non confidential drawing set with a couple of squares and circles. The principals will be exactly the same.
Here is a sample to get started. It starts off by requiring an assembly view rep to be placed on the drawing. Run the rule and any future view rep will then be created. The rule places only the front view.
- Views created from view reps
'https://forums.autodesk.com/t5/inventor-customization/ilogic-drawing-view-height-and-size-problem/td-p/9256794
'https://forums.autodesk.com/t5/inventor-forum/place-all-design-views-on-an-idw/td-p/6035731
Sub Main
CreateViewForEachRep()
End Sub
Public Sub CreateViewForEachRep()
' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
'Set a reference to the active sheet.
Dim oSheet As Sheet
oSheet = oDrawDoc.ActiveSheet
Dim viewScale As Double
viewScale = 1/20
Dim ptx As Long
ptx = 0
'this assumes that view1 is of the full assembly - a view must have been placed in a drawing before running this
Dim assyDocName As String
assyDocName = oSheet.DrawingViews.Item(1).ReferencedDocumentDescriptor.FullDocumentName
Dim assyDoc As AssemblyDocument
'open assembly doc invisibly
assyDoc = ThisApplication.Documents.Open(assyDocName, False)
Dim oAssyCompDef As AssemblyComponentDefinition
oAssyCompDef = assyDoc.ComponentDefinition
Dim oRepMgr As RepresentationsManager
oRepMgr = oAssyCompDef.RepresentationsManager
Dim oDesView As DesignViewRepresentation
For Each oDesView In oRepMgr.DesignViewRepresentations
If oDesView.Name.Contains("SP") Then
Dim oPoint1 As Point2d
oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(ptx, 11)
Call PlaceBaseView(oSheet, assyDoc, oPoint1, oDesView.Name,viewScale)
End If
ptx = ptx + 6
'ptx = ptx + 2 +(VWidth/2)
Next
'close assembly doc
assyDoc.Close (False)
End Sub
Public Sub PlaceBaseView(ByRef sheet As Inventor.Sheet, _
ByRef assyDoc As AssemblyDocument, _
ByRef oPoint1 As Point2d, _
ByRef viewName As String, _
ByRef viewScale As Double)
'define view orientation
Dim vieworient1 As ViewOrientationTypeEnum
vieworient1 = ViewOrientationTypeEnum.kFrontViewOrientation
'define view style
Dim viewstyle1 As DrawingViewStyleEnum
viewstyle1 = DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle
Dim oFaceView As DrawingView
oFaceView = sheet.DrawingViews.AddBaseView(assyDoc, oPoint1, viewScale, vieworient1, viewstyle1, viewName)'viewScale
'Set view reps associative so they update when model changes. Othewise they are a static image
oFaceView.SetDesignViewRepresentation(viewName,True)
End Sub
Improvements required for this rule.
- Control size of views by changing scale.
- Control position of views.
- If view rep views do not fit on sheet move to next sheet.
It looks like a previous help request has worked on moving views.
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan