Results 1 to 6 of 6

Thread: Getting text height from "standard" text style

  1. #1
    Member
    Join Date
    2013-03
    Posts
    36
    Login to Give a bone
    0

    Default Getting text height from "standard" text style

    I am using the below code snippet to get text heights. This code fails only when the current dimension style is "standard"

    Any insight as to why?

    Code:
    (defun c:sth ()
      (setq txttype (getstring "\n\"alt\" or [\"reg\"]"))
      (cond ((/= txttype "alt") (setq txttype "reg")))
    
    
      (if (= (getvar 'ctab) "Model")
        (setq dimsc (getvar 'dimscale))
        (setq dimsc 1)
      )
      (setq    txtheight
         (cdr
           (assoc 140
              (entget (tblobjname "dimstyle" (getvar 'dimstyle)))
           )
         )
      )
      (setq txtheight (* txtheight dimsc))
    
    
      (cond
        (
         (= txttype "alt")
         (setq txtheight (* txtheight 0.6))
        )
      )
    
    
      (setvar "textsize" txtheight)
    )

  2. #2
    All AUGI, all the time Tharwat's Avatar
    Join Date
    2010-06
    Posts
    865
    Login to Give a bone
    0

    Default Re: Getting text height from "standard" text style

    Hi,

    Nothing to let the codes to fail even if the current active dimension style is Standard, so you may have another part of codes cause that error.

    And what's the error message you receive by the way?

  3. #3
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL
    Posts
    3,020
    Login to Give a bone
    0

    Default Re: Getting text height from "standard" text style

    As an alternative this lisp gives you multiple options for setting text height. You can select any Text, Mtext or Attribute even in an xref to get it's height. Pressing Enter instead will use the current annotation scale to get the text height required to plot text at a height of 0.1. You're then given the option to either set that as the text height, enter a different value, or pick two points to set the value. For a different default height for plotting text change the two 0.1 values to whatever you want.

    As I use Annotative Dimensions I haven't used "dimscale" for anything in quite a while.
    Attached Files Attached Files
    Tom Beauford P.S.M. - Civil 2019 on Windows 10 Enterprise
    Design Analysis - Leon County Public Works/Engineering Wrap [CODE] tags around selected text
    2280 Miccosukee Rd. Tallahassee, FL 32308-5310
    Ph# (850)606-1516 Home Page

  4. #4
    Member
    Join Date
    2013-03
    Posts
    36
    Login to Give a bone
    0

    Default Re: Getting text height from "standard" text style

    Quote Originally Posted by Tharwat View Post
    Hi,

    Nothing to let the codes to fail even if the current active dimension style is Standard, so you may have another part of codes cause that error.

    And what's the error message you receive by the way?
    The error is: ; error: bad argument type: numberp: nil

    and happens with the ..(cdr (assoc 140... there doesn't appear to be a "140" associated with
    the "standard" dimstyle dxf. That's what I was wondering about...

  5. #5
    All AUGI, all the time Tharwat's Avatar
    Join Date
    2010-06
    Posts
    865
    Login to Give a bone
    0

    Default Re: Getting text height from "standard" text style

    Hi,

    Try it this way.
    Code:
    (cdr (assoc 140 (entget (cdr (assoc -1 (entget (tblobjname "dimstyle" "Standard")))))))

  6. #6
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL
    Posts
    3,020
    Login to Give a bone
    0

    Default Re: Getting text height from "standard" text style

    Quote Originally Posted by Frank Dux View Post
    I am using the below code snippet to get text heights. This code fails only when the current dimension style is "standard"

    Any insight as to why?

    Code:
           (assoc 140 (entget (tblobjname "dimstyle" (getvar 'dimstyle))))
    If you create a copy of Standard it will not have a value until it's changed from the Standard value either. Apparently most of those DXF values are overrides of Standard and simply don't exist unless they've been set different than the Standard dimension style.

    I couldn't find any info on where the Standard dimension values are stored, if anyone figures where that is let us know.
    Tom Beauford P.S.M. - Civil 2019 on Windows 10 Enterprise
    Design Analysis - Leon County Public Works/Engineering Wrap [CODE] tags around selected text
    2280 Miccosukee Rd. Tallahassee, FL 32308-5310
    Ph# (850)606-1516 Home Page

Similar Threads

  1. 2014: Remove "LEROY" Text Style?
    By Andy.88917 in forum ACA General
    Replies: 3
    Last Post: 2014-12-17, 08:57 PM
  2. 2014: Annotative text "Paper defined" and "Model defined" height?
    By sandeep_koodal in forum AutoCAD General
    Replies: 3
    Last Post: 2014-10-29, 06:02 AM
  3. Lock Text Height in Dimension Style when Text Style Height is Not 0
    By acadwishlist in forum AutoCAD Wish List
    Replies: 2
    Last Post: 2013-01-16, 04:55 AM
  4. Persistent Text Style "DELTASYMBOL"
    By Tom Beauford in forum AutoCAD Customization
    Replies: 2
    Last Post: 2008-03-14, 05:53 PM
  5. Replies: 5
    Last Post: 2005-01-04, 07:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •