Dimensions adapted according to the size of the plate.

Dimensions adapted according to the size of the plate.

sbcJLYKK
Contributor Contributor
383 Views
2 Replies
Message 1 of 3

Dimensions adapted according to the size of the plate.

sbcJLYKK
Contributor
Contributor

Hi

I hope you can help me.


I have the following code: 

 

Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Sheet:1")
Dim Front_View = Sheet_1.DrawingViews.ItemByName("Front_View")
Dim Left_Face = Front_View.GetIntent("Left_Face")
Dim Bottom_Face = Front_View.GetIntent("Bottom_Face")

Dim Bottom_Face_Square = Front_View.GetIntent("Bottom_Face_Square")
Dim Top_Face_Square = Front_View.GetIntent("Top_Face_Square")
Dim Right_Face_Square = Front_View.GetIntent("Right_Face_Square")
Dim Left_Face_Square = Front_View.GetIntent("Left_Face_Square")

Dim WPO_Edge_Front_Square = Front_View.GetIntent("WPO_Edge_Front_Square")
Dim WPO_Edge_Left_Square = Front_View.GetIntent("WPO_Edge_Left_Square")
Dim WPO_Edge_Top_Square = Front_View.GetIntent("WPO_Edge_Top_Square")
Dim WPO_Edge_Front_Bottom = Front_View.GetIntent("WPO_Edge_Front_Bottom")

Dim genDims = Sheet_1.DrawingDimensions.GeneralDimensions

'Calculations 47,5
Dim TopWidthPos = ThisDrawing.Geometry.Point2d(0, 0)
TopWidthPos.InDatabaseUnits = WPO_Edge_Left_Square.PointOnSheet
TopWidthPos.Y = TopWidthPos.Y - 190 * Front_View.Scale

'Calculations 185
Dim TopLengthPos = ThisDrawing.Geometry.Point2d(0, 0)
TopLengthPos.InDatabaseUnits = WPO_Edge_Top_Square.PointOnSheet
TopLengthPos.Y = TopWidthPos.Y - 2 * Front_View.Scale

'Calculations 140
Dim LengthPos = ThisDrawing.Geometry.Point2d(0, 0)
LengthPos.InDatabaseUnits = WPO_Edge_Left_Square.PointOnSheet
LengthPos.X = LengthPos.X - 67 * Front_View.Scale


'Calculations 70
Dim HeighPos = ThisDrawing.Geometry.Point2d(0, 0)
HeighPos.InDatabaseUnits = WPO_Edge_Front_Bottom.PointOnSheet
HeighPos.X = HeighPos.X - 160 * Front_View.Scale

ThisDrawing.BeginManage
Dim linDim1 = genDims.AddLinear("Width", TopWidthPos, Left_Face, Left_Face_Square)
Dim linDim2 = genDims.AddLinear("SquareLength", TopLengthPos, Right_Face_Square, Left_Face_Square)
Dim linDim3 = genDims.AddLinear("Length", LengthPos, Top_Face_Square, Bottom_Face_Square)
Dim linDim4 = genDims.AddLinear("Heighh", HeighPos, Bottom_Face, Bottom_Face_Square)

linDim1.NativeEntity.Tolerance.SetToDeviation(0.1, -0.1)
linDim1.NativeEntity.TolerancePrecision = 0

linDim2.NativeEntity.Tolerance.SetToDeviation(0.1, -0.1)
linDim2.NativeEntity.TolerancePrecision = 0

linDim3.NativeEntity.Tolerance.SetToDeviation(0.1, -0.1)
linDim3.NativeEntity.TolerancePrecision = 0

linDim4.NativeEntity.Tolerance.SetToDeviation(0.1, -0.1)
linDim4.NativeEntity.TolerancePrecision = 0


'linDim3.NativeEntity.Text.FormattedText = String.Concat("<DimensionValue/>", " x 4")
ThisDrawing.EndManage

 

It works really well and as such as intended.

 

I have a plate, pleace see the image Test1

 

The image, Test1 shows a standard which I work from.

 

When I change the size of the plate, for example 400 x 400 mm,

the dimensions of the automated working drawing are not adjusted.

 

Please see picture "Test"

 

Can you help me change the code so that the goals are adapted according to the size of the plate.

 

0 Likes
384 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

Hi @sbcJLYKK.  That behavior certainly sounds odd.  Are you updating the drawing document each time immediately after your model changes, or right after your codes finish running.  Are you including any codes to update the drawing document after placing all the dimensions?  It kind of seems like the dimension text has been manually edited, and made to be 'static', so that its value is no longer being displayed, but is just displaying static text instead.  Have the dimension text been edited in any way?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

sbcJLYKK
Contributor
Contributor

Hi WCrihfield

Thank you very much for your reply


Answer to your questions:

Are you including any codes to update the drawing document:

Answer:
I have a code that update


Dim oCurrentSheet As Sheet

oCurrentSheet = ThisDoc.Document.ActiveSheet

Dim oSheet As Sheet

For Each oSheet In ThisDoc.Document.Sheets

oSheet.Activate

oSheet.Update
Next

oCurrentSheet.Activate

 

It kind of seems like the dimension text has been manually edited.

Answer:
I have built up the dimensioning with coding.

I have not manually been inside and dimensioning


I have attached a copy of the templates, IPT and IDW.

If I ask nicely though, I could get you to look at it

I can not really figure out what could be wrong.

0 Likes