Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Set the First Drawing View on Drawing

5 REPLIES 5
Reply
Message 1 of 6
ReneRepina
942 Views, 5 Replies

Set the First Drawing View on Drawing

Hello!

 

I created a solution to Set the First Drawing View on Drawing in case we already have a drawing with multiple different drawing views and we want to extract the data from the specific one (in case it is not already a first view).

The iLogic code is in attachments (as .txt, because .iLogicVb is not supported).

I hope you will find it useful!

 

P.S.: Read the important informations inside the iLogic file.

 

 

Links to ideas for this function inside Inventor:

https://forums.autodesk.com/t5/inventor-ideas/change-quot-main-view-quot-in-drawings/idi-p/6827444

https://forums.autodesk.com/t5/inventor-ideas/ability-to-choose-which-parts-are-referenced-in-dwg-ti...

 

Example run:

ReneRepina_0-1616282134146.png

ReneRepina_1-1616282137456.png

 

Labels (1)
5 REPLIES 5
Message 2 of 6
davis.j
in reply to: ReneRepina

This is great. Thanks for this.

Might it be possible to utilize some of the code in the following example to pick the view rather than have to have it selected before running the ilogic. Or, you could use both where if no view is initially selected it would also ask to pick the view.

https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/auto-ballooning-a-drawing-attach-balloo...

Sub main()
	Dim selectSet As SelectSet = ThisDrawing.Document.SelectSet
    If selectSet.Count = 0 Then
        Dim selectedObj = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a drawing view")
        If selectedObj IsNot Nothing Then selectSet.Select(selectedObj)
    End If
    For Each obj In selectSet
        If TypeOf obj Is DrawingView Then
            AddBallonToView(obj)
        End If
    Next
End Sub

 

Message 3 of 6
davis.j
in reply to: ReneRepina

Also, Might it be possible to do this same treatment to the drawing view BOM? Either as a separate rule or including it within this rule. I have multiple BOM's and views per sheet and it would be nice to use this magic with a BOM driven rule such as the following:
https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/inventor-drawing-bom-or-parts-list-to-s...

Thanks,

 

Message 4 of 6
ReneRepina
in reply to: ReneRepina

Hello @davis.j .

 

Sorry for the late reply (3 years later...).

 

You are welcome.

Yes, this could be easily implement, but since new version of Inventor is already providing a function so select a main view, I think is no longer necessary to implement.

 

So basically you mean to select "main BOM" or what did you mean exacly?

Message 5 of 6
WCrihfield
in reply to: ReneRepina

Hi @ReneRepina.  I suspect he may be talking about if we have the ability to change an existing PartsList object that already exists on a Sheet within the drawing to being associated with a different DrawingView.  I do not currently know if any publicly available Inventor API method or property for this specific task, but I have seen what looks like proof that a PartsList is somehow associated with a specific DrawingView before.  Mostly only after ModelStates got involved though.  Within the method to 'set' which ModelState a DrawingView is set to (DrawingView.SetActiveModelState), there are some 'inputs' involved for updating a PartsList that may already exist and is associated with this view, and whether or not to keep any overrides you have applied to that PartsList.  The wording in the descriptions of those input parameters make you assume that the PartsList might possibly just be associated with a specific ModelState, rather than a specific view though.  And if this view is set to the same ModelState as the PartsList, then these would apply.  But my interpretation may be a bit off.  I did work on another forum post on this very topic though a while back.

https://forums.autodesk.com/t5/inventor-programming-ilogic/replacing-partslist-reference-with-models... 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 6 of 6
ReneRepina
in reply to: WCrihfield

Hello @WCrihfield .

 

Thank you for extra explanation.

I have to say that I am currently unsure of what is the request at the moment, but hopefully he will explain it.

As for the "replacing" the BOM list, not sure, if it can be done, because I think once it is placed, it is "anchored" to specific file / view. I could be wrong though.

But if only new BOM is needed, which is connected to "main" view, this can be done with "deleting" the old BOM and adding the new BOM on the drawing via iLogic. If this is done on the beggining, when no balloons are on the drawing, it works OK, not sure what happens, if balloons are already on the drawing and then we delete the BOM and put another one on the drawing. Do balloons get deleted or are referenced to previous BOM, because I am not sure, if they would be automatically updated. Did not test that.

 

 

Best regards,

Rene Repina

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report