Change Dimension Def Points

Change Dimension Def Points

DGCSCAD
Collaborator Collaborator
573 Views
6 Replies
Message 1 of 7

Change Dimension Def Points

DGCSCAD
Collaborator
Collaborator

Hi all,

 

I'm looking for a nudge in the right direction to change the 2nd def point of an existing dimension. I have the new point saved as a variable, just need the dxf code for the def point (I'm not sure which one to use) to move to it.

 

Thank you in advance. 🙂

 

 

AutoCad 2018 (full)
Win 11 Pro
0 Likes
Accepted solutions (2)
574 Views
6 Replies
Replies (6)
Message 2 of 7

ВeekeeCZ
Consultant
Consultant

Better post a sample dwg with before and after. Are your dims associative and you're planning to keep it that way?

0 Likes
Message 3 of 7

chriscowgill7373
Advisor
Advisor
Accepted solution

What I usually do in these situations is to create two identical dimensions, change one with the item I am looking for, then entget and list the data and compare the two.  The dxf code that contains the change I am expecting is the one I need.

(Defun select (/ object objent objentdata)
(Setq object (ssget)
objent (ssname object 0)
objentdata (entget objent)
)
)

It can be called using (select) at the command line 


Christopher T. Cowgill, P.E.

AutoCAD Certified Professional
Civil 3D Certified Professional
Civil 3D 2024 on Windows 10

Please select the Accept as Solution button if my post solves your issue or answers your question.

Message 4 of 7

DGCSCAD
Collaborator
Collaborator

I'll post a dwg if needed, but for now:

 

  • It doesn't need to be associative.
  • The dimension is the last entity.
  • Need to move def point/ext line 2 to new point saved as variable: (209.884 61.0101 0.0)

Does that help?

 

AutoCad 2018 (full)
Win 11 Pro
0 Likes
Message 5 of 7

ВeekeeCZ
Consultant
Consultant

Post dwg.

Message 6 of 7

Kent1Cooper
Consultant
Consultant
Accepted solution

14 for linear/rotated/aligned

 

Some Association List Codes for defining locations within Dimensions:
10 is --
  linear: arrow point end of dimension line where it meets extension line 2
  2-line angular: end of first-picked line element
13 is -- linear or 3pt angular: defpoint 1; 2-line angular: start of second-picked line element
14 is -- linear or 3pt angular: defpoint 2; 2-line angular: end of second-picked line element
15 is angular only: start of first-picked line element, or center of arc or circle

Kent Cooper, AIA
Message 7 of 7

DGCSCAD
Collaborator
Collaborator

Thank you Kent1Cooper and chriscowgill7373!

You both had what I was looking for.

Here's the code:

 

(defun c:Ch_Dim_Pt2 (/ object objent en3 en4 ps_dim2_ins2)
(setq ps_dim2_ins2 (list 209.884 61.0101 0.0)); Set new point
(setq object (ssget "l")); Get last entity, which is a Linear Dimension
(setq objent (ssname object 0)); Get dim entity name
(setq en3 (entget objent)); Get dim entity data
(setq en4 (subst (cons 14 ps_dim2_ins2) (assoc 14 en3) en3)); Set new defpoint 2
(entmod en4); Apply changes
(entupd objent); Update entity
)

 

AutoCad 2018 (full)
Win 11 Pro
0 Likes