CopyTo Drawing View Object issues

CopyTo Drawing View Object issues

Anonymous
Not applicable
466 Views
3 Replies
Message 1 of 4

CopyTo Drawing View Object issues

Anonymous
Not applicable

I am trying to create a VBA code to automate moving Drawing Views to another sheet.  I am looping through a collection in a selection set and picking out the drawing view objects.  It works fine until a Leader Note is inside the drawing view then it fails.  So I created a filter to filter out the Leader Notes and it works great if the leader extends outside the Drawing View but when it is in the drawing view it fails.  What are my options?

 

I catch the the Drawing view with 

If itm.Type = kDrawingViewObject Then 'or 117441536 
     Call itm.CopyTo(DestSheet)
End If

I catch the leaders that go outside the Drawing view with

If SelCol(counter).Type = kLeaderNoteObject Then 'or 117473024
    For X = 1 To SelCol(counter).Leader.AllNodes.Count
        oObjCol.Add SelCol(counter).Leader.AllNodes(X).Position
    Next
    Set NLN = DestSheet.DrawingNotes.LeaderNotes.Add(oObjCol, SelCol(counter).FormattedText, SelCol(counter).DimensionStyle)
End If

 

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

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

For further investigation, can you please provide sample drawing and source code?

 

Please make sure that files are non confidential.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 4

Anonymous
Not applicable

I am sorry been away from desk.

I figured out I was capturing the selection inefficiently.  If I use the below code it works great.

    Dim SelCol As ObjectCollection
    Set SelCol = ThisApplication.TransientObjects.CreateObjectCollection
    
    Dim obj As Variant
    For Each obj In oDoc.SelectSet
        SelCol.Add obj
    Next

 

0 Likes
Message 4 of 4

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

That's nice to hear that you figured out a solution.

 

Please feel free to contact if you need any help further.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes