LauKwokFai Posted November 13, 2013 Share Posted November 13, 2013 Hi all, I am trying to work on an autolisp relates to dimensions and need the dimension rotated angle which is normally stored in assoc code 50 (I think), and I happened to find out that there are some dimensions' assoc code 50 is always 0.0 even if it is rotated. I compared 2 type of dimensions, the one has "normal" assoc code 50 has an additional code (100 . "AcDbRotatedDimension"), I tried "MATCHPROP" but doesn't work. Can anyone please help me to resolve this problem. Thanks so much. Quote Link to comment Share on other sites More sharing options...
MSasu Posted November 13, 2013 Share Posted November 13, 2013 The one that store rotation angle is a linear dimension inserted using Rotated option. The second one is an aligned one; you may get its rotation from the relative location of insertion points (DXF codes 10 and 11). Quote Link to comment Share on other sites More sharing options...
LauKwokFai Posted November 13, 2013 Author Share Posted November 13, 2013 Ahhh......Thanks a lot. Meaning I have do some sin/cos calculations to obtain the rotate angle Quote Link to comment Share on other sites More sharing options...
MSasu Posted November 13, 2013 Share Posted November 13, 2013 Not really required, just use ANGLE built-in function: (angle (cdr (assoc 11 assocListAlignDim)) (cdr (assoc 10 assocListAlignDim)) Quote Link to comment Share on other sites More sharing options...
LauKwokFai Posted November 13, 2013 Author Share Posted November 13, 2013 but DXF code 11 is the insertion point of text which could be varies while DXF code 10 is the end point of the dimension line. Quote Link to comment Share on other sites More sharing options...
MSasu Posted November 13, 2013 Share Posted November 13, 2013 Yes, you are right, my mistake. Seems that will have to look for DXF codes 13 and 14, instead. Sorry for inconvenience. Quote Link to comment Share on other sites More sharing options...
LauKwokFai Posted November 13, 2013 Author Share Posted November 13, 2013 can't do that with DXF code 13 and 14 either, because the location of both 13 & 14 can be varies too !! I am trying to work out the relationship between the distance/angle of DXF 10 & 14 and the distance/angle of DXF 14 & 13 Quote Link to comment Share on other sites More sharing options...
MSasu Posted November 13, 2013 Share Posted November 13, 2013 According to DXF reference, the codes 13 and 14 were "Definition point for linear and angular dimensions". So, seems reliable to me to calculate the orientation of aligned dimensions. Can you post, please a skecth with a case when those were not matching the angle? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 13, 2013 Share Posted November 13, 2013 Just an example for you to consider . (setq e (entget (car (entsel "\n Select Dim :")))) (setq a (cdr (assoc 13 e)) b (list (car (cdr (assoc 14 e))) (cadr a) (caddr (cdr (assoc 14 e)))) d (distance a b) ang (angle a b) ) Quote Link to comment Share on other sites More sharing options...
LauKwokFai Posted November 13, 2013 Author Share Posted November 13, 2013 this is the first time I attach an image here, hope didn't create any horrible thing Quote Link to comment Share on other sites More sharing options...
MSasu Posted November 13, 2013 Share Posted November 13, 2013 Sorry, but that isn't an aligned dimension. An aligned one will follow the application points, and it's DXF code 50 will be 0.0. Seems that is about a linear one and for this case the said DXF code will bear the angle of dimension line. Don't worry, the image is OK. You removed your previous post, so looked like I was replying to Tharwat. For this reason I moved my post, too. Quote Link to comment Share on other sites More sharing options...
LauKwokFai Posted November 13, 2013 Author Share Posted November 13, 2013 actually the lisp I want to do is in our company people make the dimension in a real messy way, extension lines all over the places, the attached JPG is showing one dimension only, but it is usually a bunch of continue dimensions with these uneven extension lines. What I want to do is to line up all the extension lines (line up all the DXF 14 & 13) according to the location I specify. Therefore I need the angle. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 13, 2013 Share Posted November 13, 2013 Did you find my previous post of any help in that regard ? Quote Link to comment Share on other sites More sharing options...
LauKwokFai Posted November 13, 2013 Author Share Posted November 13, 2013 MSasu, thanks and you are right, I just realized that only the first dimension is an aligned dimension which has DXF 50 0.0, the rest of the continued dimensions are linear. Quote Link to comment Share on other sites More sharing options...
MSasu Posted November 13, 2013 Share Posted November 13, 2013 Please don't miss that for aligned dimension if you adjust the codes 13 and 14 this will mess the dimension line orientation and the measured value! Quote Link to comment Share on other sites More sharing options...
LauKwokFai Posted November 13, 2013 Author Share Posted November 13, 2013 Tharwat, thank you so much, but it seems work only when 13, 14 are aligned Please don't miss that for aligned dimension if you adjust the codes 13 and 14 this will mess the dimension line orientation and the measured value! Yes, this seems to be the headache part. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 13, 2013 Share Posted November 13, 2013 This function should return the points you require: (defun dimpoints ( ent / g10 g13 vec ) (setq ent (entget ent) g10 (cdr (assoc 10 ent)) g13 (cdr (assoc 13 ent)) vec (trans (mapcar '- g10 (cdr (assoc 14 ent))) 0 1) ) (list g10 (trans (inters (trans g10 0 1) (mapcar '+ (trans g10 0 1) (list (- (cadr vec)) (car vec))) (trans g13 0 1) (mapcar '+ (trans g13 0 1) vec) nil ) 1 0 ) ) ) Call with the Dimension entity name: (dimpoints <dimension-entity>) Returns points in WCS. Quote Link to comment Share on other sites More sharing options...
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.