Nesting views on sheet

Nesting views on sheet

floccipier
Advocate Advocate
378 Views
3 Replies
Message 1 of 4

Nesting views on sheet

floccipier
Advocate
Advocate

Hi All, 

Kind off assemblies I am working on these days sometimes do have hundreds of small parts and they all need to be detaild (this parts has been automated). Now what I am struggling with is to keep arranging them manually on sheets. I was wondering if there is way to nest the views on sheet. Workflow I am trying to achieve is something like this. 

 

1. If there are just few views arrange them on sheet as given scale. 

2. If views doesn't fit then scale down (we look at length parameter of part and there should be limit to how much we can scale it down). 
3. after scaling down if views still can't fit on sheet, move them to new sheet(s). 

Best regards, 
flo

0 Likes
379 Views
3 Replies
Replies (3)
Message 2 of 4

A.Acheson
Mentor
Mentor

How are the views detailed using view rep from assembly and or there own part/assembly file inside in there own drawing?

 

Having one part per drawing is the easiest way to accomplish this but it sounds like your not using this method. Can you share screen shots of what you want to accomplish with view reps etc if present. 

If you also have a starting code you have worked on please share that with a drawing sample in zipped folder.

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 4

floccipier
Advocate
Advocate

Can I share drawing sample and more details privately through email or something?

0 Likes
Message 4 of 4

A.Acheson
Mentor
Mentor

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.

  1. 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.

 

  1. Control size of views by changing scale.
  2. Control position of views.
  3. 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
0 Likes