Jump to content

No assoc code info in some rotated dimensions


LauKwokFai

Recommended Posts

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.

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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)
)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...