problem with SheetMetal.FlatExtents

problem with SheetMetal.FlatExtents

Jakob_Hamburg
Advocate Advocate
214 Views
1 Reply
Message 1 of 2

problem with SheetMetal.FlatExtents

Jakob_Hamburg
Advocate
Advocate

Hello all,

 

I have a problem with SheetMetal.FlatExtents:

 

I want to get the flat patterns dimension, therefore I use SheetMetal.FlatExtents.

But sometimes I get a dimension that is rounded up to next integer (e.g. 201 mm) although it is exact ("200.0000 mm").

I am working with multibodies. the components I create out of the multibody should be exact the same but they differ sometimes by this strangely false rounded 1 mm.

Maybe it is because those parts are on different sides of the coordinate origin and then it is somehow in the negative direction of the axis?  

 

first I tried a code like this:

Function SheetMetalRange(ByRef smDef As SheetMetalComponentDefinition)

Dim xSize As Integer
Dim ySize As Integer

Dim l As List(Of Integer) = New List(Of Integer)

xSize = (SheetMetal.FlatExtentsLength)
ySize = (SheetMetal.FlatExtentsWidth)
l.Add(xSize)
l.Add(ySize)
l.Sort()

Return l
End Function

 

But then I got for a dimension "37.5" sometimes the result "37" and sometimes "38".

 

I thought "Ceil" might help, so i modified my code:

 

Function SheetMetalRange(ByRef smDef As SheetMetalComponentDefinition)
  	
	'Dim xSize As Integer
	'Dim ySize As Integer
	Dim xSize As Double
	Dim ySize As Double
	Dim l As List(Of Integer) = New List(Of Integer)
	
	xSize = Ceil(SheetMetal.FlatExtentsLength)
	ySize = ceil (SheetMetal.FlatExtentsWidth)
	l.Add(xSize)
	l.Add(ySize)
	l.Sort()

	Return l
End Function

But now I get for a dimension "200 mm" sometimes "201" and sometimes "200".

 

Does anyone have an advice for me? 

0 Likes
Accepted solutions (1)
215 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor
Accepted solution

Why are you using 'Integer' type variable's to store Double type data?  When using the Integer, it will always attempt to convert the Double to Integer by rounding the decimal portion of the value to get an integral value.  Is that always what you want?  The SheetMetal.FlatExtentsLength & SheetMetal.FlatExtentsWidth both return Double type data.  Maybe if you changed your variable data type from Integer to Double, and your List data type from Integer to Double, then used whichever of the available iLogic Math methods that best suits your needs to interpret the value the way you want it.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes