FORMULA IN DIMENSION

FORMULA IN DIMENSION

Leonardo_Czuy
Advocate Advocate
445 Views
4 Replies
Message 1 of 5

FORMULA IN DIMENSION

Leonardo_Czuy
Advocate
Advocate

Hello

I would like that every time I place a dimension, it adds 150 to show the actual value. I made a section break of 150mm and I would like the dimensions to already come with this value without needing to edit.

<Measurement> + 150 
Leonardo_Czuy_0-1708454848791.png

 

0 Likes
Accepted solutions (1)
446 Views
4 Replies
Replies (4)
Message 2 of 5

paullimapa
Mentor
Mentor

How’s AutoCAD going to know that this object currently doesn’t have a section break =600 or does have a section break which is now shorter by 150 but you don’t want it to show the real dimension of 600-150?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 5

Kent1Cooper
Consultant
Consultant

It would be possible to write a routine for a specific reduction amount, such as your 150, which would calculate the difference and override the text content of the Dimension.  But it has the drawback that if you modify anything about the situation, the Dimension text, being overridden, will not update accordingly.  You would need to realize that such a Dimension is no longer correct, and presumably remove it and do it again with the same routine, or a different one if what has changed is the cut-out length.  If that's acceptable, something could be done.

Kent Cooper, AIA
0 Likes
Message 4 of 5

ВeekeeCZ
Consultant
Consultant
Accepted solution

Possibly like this.

 

(vl-load-com)

(defun c:DimBroken ( / GetObjectID p e i)
  
  (or *dimbroken-dst* (setq *dimbroken-dst* 150.))
  
  (defun GetObjectID ( obj doc )
    (if (eq "X64" (strcase (getenv "PROCESSOR_ARCHITECTURE")))
      (vlax-invoke-method
	(vla-get-Utility doc) 'GetObjectIdString obj :vlax-false)
      (itoa (vla-get-Objectid obj))))
  
  (setq *dimbroken-dst* (cond ((getdist (strcat "\nSpecify how much broken they are <" (rtos *dimbroken-dst*) ">: "))) (*dimbroken-dst*)))
  
  (while (setq p (getpoint "\nSpecify first extension line origin: "))
    (command "_.dimlinear" "_non" p)
    (while (> (getvar 'cmdactive) 0) (command pause))
    (setq e (entlast))
    (setq i (GetObjectID (vlax-ename->vla-object e) (vla-get-ActiveDocument (vlax-get-acad-object))))
    (setpropertyvalue e "Suffix" (rtos *dimbroken-dst*))
    (setpropertyvalue e "DimensionText"
      (strcat "%<\\AcExpr ("
	      "%<\\AcObjProp Object(%<\\_ObjId " i ">%).Measurement>%"
	      "+"
	      "%<\\AcObjProp Object(%<\\_ObjId " i ">%).TextSuffix>%"
	      ") \\f \"%lu2%pr0\">%")))
  (vla-regen (vla-get-ActiveDocument (vlax-get-acad-object)) acActiveViewport)
  (princ)
  )

 

The length of reduction is stored in SUFFIX. You can change it if needed, then regen to update.

If you prefer the aligned dims over linear, just change the word.

https://www.lee-mac.com/runlisp.html

0 Likes
Message 5 of 5

Sea-Haven
Mentor
Mentor

My $0.05 in a dim if you have <> as default string it will show the distance between extensions so before you break the object reset the dim value to text. This image shows original length, plus override  and then I dragged one end, so if I look at new dim string its "20.43<>" so using only the "20.43" is what you want. 2 ways to change entmod or a Vla-put. It does not matter about the break gap as you have overridden the dim measurement.

 

 

SeaHaven_0-1708584508956.png

 

0 Likes