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: 

RangeBox error. Adding plan sizes to the dimension result!

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
mucip
612 Views, 3 Replies

RangeBox error. Adding plan sizes to the dimension result!

Hi,

I can get length, width, height information from part or assembly below Visual Basic Express 2010 code.

 

Everything is perfect. But if any plan or axis visible in document than results comes wrong!  I think box object calculating the dimensions not only according to raw part. It adding the axis or plan dimensions to the result!... 😞

 

This is very strange! Any info?!...

 

Regards,

Mucip:)

 

 

Dim invDoc As Document
invDoc = Form1.invDocumentTakas

 

Dim dLength As Double
Dim dWidth As Double
Dim dHeight As Double

 

Dim oExtent As Box

 

Dim CompDef As ComponentDefinition
CompDef = invDoc.ComponentDefinition

 

oExtent = CompDef.RangeBox
dLength = oExtent.MaxPoint.X - oExtent.MinPoint.X
dWidth = oExtent.MaxPoint.Y - oExtent.MinPoint.Y
dHeight = oExtent.MaxPoint.Z - oExtent.MinPoint.Z

 

 

 

 

3 REPLIES 3
Message 2 of 4
mucip
in reply to: mucip

Hi,

Not a really solution but it worked for me...

 

I hide everything before create rangebox. Code is below;

 

Dim oCommandMgr As CommandManager
oCommandMgr = Form1.inv_App.CommandManager

' Get control definition for the line command.
Dim oControlDef As ControlDefinition
oControlDef = oCommandMgr.ControlDefinitions.Item("AppAllWorkfeaturesCmd")
' Execute the command. 
Call oControlDef.Execute()

 

'Creating rangebox and learning dimensions here...

'...

 

' Running code again to show all again...


Call oControlDef.Execute()

 

 

 

Regards,

Mucip:)

Message 3 of 4
mucip
in reply to: mucip

Hi,

Any info about this error?...

 

Regards,

Mucip:)

Message 4 of 4
mucip
in reply to: mucip

Hi,

There is no info about the rangebox unfortunately. I found my own solution.

 

I hide all workplanes and work axes before than create rangebox. I'am using below code to hide all..

 

Dim wp As WorkPlane
Dim wx As WorkAxis
'Hide all
For Each wp In invDoc.ComponentDefinition.WorkPlanes
wp.Visible = False
Next
For Each wx In invDoc.ComponentDefinition.workAxes
wx.Visible = False
Next

 

Regards,

Mucip:)

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

Post to forums  

Autodesk Design & Make Report