DomC Posted September 23, 2021 Share Posted September 23, 2021 (edited) Dimension Direction.vwx Hello I am able to check if a Dimension is vertical or horizontal with direction = vs.GetObjectVariableReal(dim,value) On my mac version, it returns 0 for horizontal and 1.0 or -1.0 for vertical Dimensions. Unfortunately this seems not to work on Windows. There is always 0.0. I could test if xDiff is bigger than yDiff (of the Dimension Points) an decide it is horizontal but this can result in errors with some dimensions. Anyone has an Idea to get that information reliable? Edited September 23, 2021 by DomC Quote Link to comment
Julian Carr Posted September 23, 2021 Share Posted September 23, 2021 Hi Dom, Try this:Procedure T; VAR h1 : HANDLE; b1, b2, b3 : BOOLEAN; i1 : INTEGER; r1, rAngle : REAL; BEGIN h1 := FIn3D(FSActLayer); REPEAT IF (GetType(h1) = 2) THEN BEGIN GetMarker(h1, b2, b3, i1, r1); IF b2 | b3 THEN BEGIN b1 := True; rAngle := HAngle(h1); END; END; h1 := NextObj(h1); UNTIL (h1 = Nil) | b1; Message('Angle is: ', rAngle); END; Run(T); Quote Link to comment
Julian Carr Posted September 23, 2021 Share Posted September 23, 2021 Even better as a function: Function GetDimAngle(h1 : HANDLE) : REAL; VAR h2 : HANDLE; i1 : INTEGER; r1 : REAL; b1, b2, b3 : BOOLEAN; BEGIN h2 := FIn3D(h1); REPEAT IF (GetType(h2) = 2) THEN BEGIN GetMarker(h2, b2, b3, i1, r1); IF b2 | b3 THEN BEGIN b1 := True; GetDimAngle := HAngle(h2); END; END; h2 := NextObj(h2); UNTIL (h2 = Nil) | b1; END; 2 Quote Link to comment
DomC Posted September 23, 2021 Author Share Posted September 23, 2021 Fantastic Julian this is a very reliable solution, Thank you. I implemented this way: dim = vs.FSActLayer() def GetDimAngle(h1): h2 = vs.FIn3D(h1) DimAngle = 0 while h2 != vs.Handle(0): if vs.GetTypeN(h2) == 2: BOOLEAN, style, angle, size, width, thicknessBasis, thickness, visibility = vs.GetObjBeginningMarker(h2) if style: DimAngle = round(vs.HAngle(h2),0) h2 = vs.NextObj(h2) return DimAngle DimAngle = GetDimAngle(dim) vs.AlrtDialog(str(DimAngle)) 1 Quote Link to comment
twk Posted February 24, 2022 Share Posted February 24, 2022 Just spent the past 3 hours trying to figure this out.... Should have searched here first!! Thanks @DomC/ @Julian Carr ! 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.