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
Solved! Go to Solution.
Solved by mucip. Go to Solution.
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:)
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:)