Change Dimension Text Override and Layer

Change Dimension Text Override and Layer

Anonymous
Not applicable
1,285 Views
3 Replies
Message 1 of 4

Change Dimension Text Override and Layer

Anonymous
Not applicable

I want to dimension nearest to perpendicular and change the text override to "<>\PROW" and make sure it's on layer "P-Dim"

Here is what I have so far. 

 

(defun c:dn()
(command "dimaligned" "nea" pause "per"pause
pause
)
(princ))

I know we would have to use this command below for the next portion but I don't know how to implement the rest. 

 (command "dimedit" "n"

Can someone help with changing the text override and layer? I'm new to lisp routines. 

 

Thanks for the help!

0 Likes
Accepted solutions (1)
1,286 Views
3 Replies
Replies (3)
Message 2 of 4

Satish_Rajdev
Advocate
Advocate
Accepted solution

Use VL functions for that, For example :-

(defun c:test ( / d)
  (vl-load-com)
  (command "dimaligned" "nea" pause "per" pause pause)
  (if (and (setq d (vlax-ename->vla-object (entlast)))
	   (wcmatch (vla-get-objectname d) "*Dimension")
      )
    (progn
      (vla-put-layer d "0")			; Add Layer Here
      (vla-put-textoverride d "ADD TEXT")	; Add Text Here
    )
  )
  (princ)
)

Best Regards,
Satish Rajdev


REY Technologies | Linked IN | YouTube Channel


 

0 Likes
Message 3 of 4

Anonymous
Not applicable

@Satish_Rajdev

That's awesome thank you so much!

I wonder, is it possible to have a multiline dimension by incorporating \P or \X into the test override?

 

ADD\PTEXT

 

0 Likes
Message 4 of 4

Satish_Rajdev
Advocate
Advocate

Yes. It's possible. For Example :-

 

(vla-put-textoverride d "ADD\PTEXT")
(vla-put-textoverride d "ADD\XTEXT")

 

If you want to join 2 different variables from it use strcat function, For example :-

(setq a "ADD")
(setq b "TEXT")
(vla-put-textoverride d (strcat a "\P" b))
(vla-put-textoverride d (strcat a "\X" b))

Best Regards,
Satish Rajdev


REY Technologies | Linked IN | YouTube Channel


 

0 Likes