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: 

Getting an error on auto arrange dimension code

2 REPLIES 2
Reply
Message 1 of 3
bmerton
453 Views, 2 Replies

Getting an error on auto arrange dimension code

I am getting the following error when running this code from this post:  http://forums.autodesk.com/t5/inventor-general-discussion/ilogic-drawing-dimension-alignment-for-par...

 

It is saying  " 'Inventorapp' is not declared. It may be inaccessible due to its protection level."

 

Can anyone help?  Am a complete novice at VB...

 

 Dim doc As Inventor.DrawingDocument
        doc = inventorApp.ActiveDocument

        Dim ActiveSheet As Inventor.Sheet
        ActiveSheet = doc.ActiveSheet

        Dim dimensions As Inventor.ObjectCollection
        dimensions = inventorApp.TransientObjects.CreateObjectCollection

        Dim drawDim As Inventor.DrawingDimension
        For Each drawDim In ActiveSheet.DrawingDimensions

            If Not TypeOf drawDim Is Inventor.OrdinateDimensionSet _
            And Not TypeOf drawDim Is Inventor.BaselineDimensionSet _
            And Not TypeOf drawDim Is Inventor.ChainDimensionSet Then
                Call dimensions.Add(drawDim)
            End If
        Next

        Call ActiveSheet.DrawingDimensions.Arrange(dimensions)

2 REPLIES 2
Message 2 of 3
salariua
in reply to: bmerton

Try

 

Dim doc As Inventor.DrawingDocument
        doc = ThisApplication.ActiveDocument
        Dim ActiveSheet As Inventor.Sheet
        ActiveSheet = doc.ActiveSheet
        Dim dimensions As Inventor.ObjectCollection
        dimensions = ThisApplication.TransientObjects.CreateObjectCollection
        Dim drawDim As Inventor.DrawingDimension
        For Each drawDim In ActiveSheet.DrawingDimensions
            If Not TypeOf drawDim Is Inventor.OrdinateDimensionSet _
            And Not TypeOf drawDim Is Inventor.BaselineDimensionSet _
            And Not TypeOf drawDim Is Inventor.ChainDimensionSet Then
                Call dimensions.Add(drawDim)
            End If
        Next
        Call ActiveSheet.DrawingDimensions.Arrange(dimensions)

 

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
Message 3 of 3
Anonymous
in reply to: salariua

Their is an error on line 6.... End of Statement Expected.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report