Jump to content

Height of dimension text


Dayananda

Recommended Posts

hi

try


(defun C:TEXTHEIGHT (/ SS TEXTHEIGHT)  
  (vl-load-com) 
    (if (setq ss (ssget '((0 . "DIMENSION"))))
    (foreach dim (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
      (setq TextHeight (cons (vla-Get-TextHeight (vlax-ename->vla-object dim) ) TextHeight ))
    )  ; foreach
  )    ; if

  (princ )
)      ; defun

 

  • Thanks 1
Link to comment
Share on other sites

I don't know but lets take a guess and see? This might or might not work, but more than half the time a good guess will or get me close.

 

Lets look at the code above then and see what it say... Hmm....TextHeight:

 

(setq TextHeight (cons (vla-Get-TextHeight (vlax-ename->vla-object dim) ) TextHeight ))

 

This is a part of a loop., TextHeight, then something and append the old TextHeght values to it. TextHeight is a list.. maybe we can make a variable TextScale and do the same thing with that.

 

Next part: vla-get-textheight.,. hmm get text height, I wonder if there is something get-scale ? Lets do a search on a list of vla-get functions (I did it for you https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/complete-list-of-vl-vla-and-vlax-functions/td-p/4666405). Looking does something that says scale, maybe vla-get-scale

 

Just a guess and working through it.

 

try this:

 

(defun C:TEXTHEIGHT (/ SS TEXTHEIGHT TextScale)  ;;Added TEXTSCALE here
  (vl-load-com) 
    (if (setq ss (ssget '((0 . "DIMENSION"))))
    (foreach dim (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
      (setq TextHeight (cons (vla-Get-TextHeight (vlax-ename->vla-object dim) ) TextHeight ))

      (setq TextScale (cons (vla-Get-scale (vlax-ename->vla-object dim) ) TextScale )) ;; added this line here

)  ; foreach
  )    ; if

  (princ )
) 

 

 

Wonder if that works? (Weekend CAD is off so not testing this, just guessing and giving you a couple of hints what to look for to change). If Scale doesn't work see what else there might be that is similar and try that (another hint here... I don't think it is scale but I think it is in that list and around that area of the list in the link above)

  • Like 1
Link to comment
Share on other sites

Using dxf codes what you want is there.

 

	       (CONS 0 "DIMSTYLE")								    ;Entity Type
	       (CONS 100 "AcDbSymbolTableRecord")						    ;Subclass marker
	       (CONS 100 "AcDbDimStyleTableRecord")						    ;Subclass marker
	       (CONS 2 xname$)									    ;Dimstyle name
	       (CONS 70 0)									    ;Standard flag value
	       (CONS 3 "")									    ;DIMPOST   - Prefix and suffix for dimension text
	       (CONS 4 "")									    ;DIMAPOST  - Prefix and suffix for alternate text
	       ;;(CONS 5 "ARR1")   -DXF CODES OBSOLETE					    ;DIMBLK    - Arrow block name
	       ;;(CONS 6 "ARR1")   -DXF CODES OBSOLETE					    ;DIMBLK1   - First arrow block name
	       ;;(CONS 7 "")         -DXF CODES OBSOLETE					    ;DIMBLK2   - Second arrow block name
	       (CONS 40 100.0)									    ;DIMSCALE  - Overall Scale Factor
	       (CONS 41 1.0)									    ;DIMASZ    - Arrow size
	       (CONS 42 2.0)									    ;DIMEXO    - Extension line origin offset
	       (CONS 43 0.0)									    ;DIMDLI    - Dimension line spacing
	       (CONS 44 2.0)									    ;DIMEXE    - Extension above dimension line
	       (CONS 45 0.0)									    ;DIMRND    - Rounding value
	       (CONS 46 0.0)									    ;DIMDLE    - Dimension line extension
	       (CONS 47 0.0)									    ;DIMTP     - Plus tolerance
	       (CONS 48 0.0)									    ;DIMTM     - Minus tolerance
	       (CONS 140 xheight$)							    ;DIMTXT    - Text height
	       (CONS 141 0.09)								    ;DIMCEN    - Centre mark size
	       (CONS 142 0.0)									    ;DIMTSZ    - Tick size
	       (CONS 143 25.4)								    ;DIMALTF   - Alternate unit scale factor
	       (CONS 144 1.0)									    ;DIMLFAC   - Linear unit scale factor
	       (CONS 145 0.0)									    ;DIMTVP    - Text vertical position
	       (CONS 146 1.0)									    ;DIMTFAC   - Tolerance text height scaling factor
	       (CONS 147 1.0)									    ;DIMGAP    - Gape from dimension line to text
	       (CONS 71 0)									    ;DIMTOL    - Tolerance dimensioning
	       (CONS 72 0)									    ;DIMLIM    - Generate dimension limits
	       (CONS 73 0)									    ;DIMTIH    - Text inside extensions is horizontal
	       (CONS 74 0)									    ;DIMTOH    - Text outside horizontal
	       (CONS 75 0)									    ;DIMSE1    - Suppress the first extension line
	       (CONS 76 0)									    ;DIMSE2    - Suppress the second extension line
	       (CONS 77 1)									    ;DIMTAD    - Place text above the dimension line
	       (CONS 78 0)									    ;DIMZIN    - Zero suppression
	       (CONS 170 0)									    ;DIMALT    - Alternate units selected
	       (CONS 171 2)									    ;DIMALTD   - Alternate unit decimal places
	       (CONS 172 0)									    ;DIMTOFL   - Force line inside extension lines
	       (CONS 173 0)									    ;DIMSAH    - Separate arrow blocks
	       (CONS 174 0)									    ;DIMTIX    - Place text inside extensions
	       (CONS 175 0)									    ;DIMSOXD   - Suppress outside dimension lines
	       (CONS 176 1)									    ;DIMCLRD   - Dimension line and leader color
	       (CONS 177 1)									    ;DIMCLRE   - Extension line color
	       (CONS 178 xcolor$)								    ;DIMCRRT   - Dimension text color
	       (CONS 270 2)									    ;DIMUNIT (Obsolete in 2011, DIMLUNIT and DIMFRAC)
	       (CONS 271 0)									    ;DIMADEC   - Angular decimal places
	       (CONS 272 0)									    ;DIMTDEC   - Tolerance decimal places
	       (CONS 273 2)									    ;DIMALTU   - Alternate units
	       (CONS 274 2)									    ;DIMALTTD  - Alternate tolerance decimal places
	       (CONS 275 0)									    ;DIMAUNIT  - Angular unit format
	       (CONS 280 0)									    ;DIMJUST   - Justification of text on dimension line
	       (CONS 281 0)									    ;DIMSD1    - Suppress the first dimension line
	       (CONS 282 0)									    ;DIMSD2    - Suppress the second dimensions line
	       (CONS 283 1)									    ;DIMTOLJ   - Tolerance vertical justification
	       (CONS 284 0)									    ;DIMTZIN   - Zero suppression
	       (CONS 285 0)									    ;DIMALTZ   - Alternate unit zero suppression
	       (CONS 286 0)									    ;DIMALTTZ  - Alternate tolerance zero suppression
	       (CONS 287 5)									    ;DIMFIT (Obsolete in 2011, DIMATFIT and DIMTMOVE)
	       (CONS 288 1)									    ;DIMUPT    - User positioned text
	       (CONS 340 (TBLOBJNAME "STYLE" xstyle$))						    ;DIMTXSTY  - Text style
	       (CONS 341
		     (CDR (ASSOC 330 (ENTGET (TBLOBJNAME "BLOCK" xstyle$))))
	       )										    ;DIMLDRBLK - Leader arrow block name
	       (CONS 342
		     (CDR (ASSOC 330 (ENTGET (TBLOBJNAME "BLOCK" xstyle$))))
	       )										    ;DIMBLK    - Arrow block name
	       (CONS 343
		     (CDR (ASSOC 330 (ENTGET (TBLOBJNAME "BLOCK" xstyle$))))
	       )										    ;DIMBLK1   - First arrow block name
	       (CONS 344
		     (CDR (ASSOC 330 (ENTGET (TBLOBJNAME "BLOCK" xstyle$))))
	       )										    ;DIMBLK2   - Second arrow block name				

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

On 2/19/2023 at 9:14 PM, Steven P said:

I don't know but lets take a guess and see? This might or might not work, but more than half the time a good guess will or get me close.

 

Lets look at the code above then and see what it say... Hmm....TextHeight:

 

(setq TextHeight (cons (vla-Get-TextHeight (vlax-ename->vla-object dim) ) TextHeight ))

 

This is a part of a loop., TextHeight, then something and append the old TextHeght values to it. TextHeight is a list.. maybe we can make a variable TextScale and do the same thing with that.

 

Next part: vla-get-textheight.,. hmm get text height, I wonder if there is something get-scale ? Lets do a search on a list of vla-get functions (I did it for you https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/complete-list-of-vl-vla-and-vlax-functions/td-p/4666405). Looking does something that says scale, maybe vla-get-scale

 

Just a guess and working through it.

 

try this:

 

(defun C:TEXTHEIGHT (/ SS TEXTHEIGHT TextScale)  ;;Added TEXTSCALE here
  (vl-load-com) 
    (if (setq ss (ssget '((0 . "DIMENSION"))))
    (foreach dim (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
      (setq TextHeight (cons (vla-Get-TextHeight (vlax-ename->vla-object dim) ) TextHeight ))

      (setq TextScale (cons (vla-Get-scale (vlax-ename->vla-object dim) ) TextScale )) ;; added this line here

)  ; foreach
  )    ; if

  (princ )
) 

 

 

Wonder if that works? (Weekend CAD is off so not testing this, just guessing and giving you a couple of hints what to look for to change). If Scale doesn't work see what else there might be that is similar and try that (another hint here... I don't think it is scale but I think it is in that list and around that area of the list in the link above)

; error: ActiveX Server returned the error: unknown name: scale

Link to comment
Share on other sites

48 minutes ago, Dayananda said:

; error: ActiveX Server returned the error: unknown name: scale

 

"If Scale doesn't work see what else there might be".... Lok in the list I linked to and see if there is anything similar to scale that you could try, if there are a few try them one at a rime and see - great way to learn is making mistakes and working out why and how things work

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