text size script

Discussion in 'AutoCAD' started by cexarhos, Apr 13, 2004.

  1. cexarhos

    cexarhos Guest

    hello,

    I am new to scripting in autocad and am looking to create a script that will reference the Standard Scale attribute of the viewport and use this to scale my text. Is this possible?
    I am use to scripting in Alias Maya and Side Effects Houdini where attributes are easily accessible. Does Autocad work this way at all.

    apprecitate the help and info,
    chris
     
    cexarhos, Apr 13, 2004
    #1
    1. Advertisements

  2. cexarhos

    bob.at Guest

    Hello chris
    this is a modified snippet from one of my programs. It scales all TEXT elements to the hight h*vps*factor, where h is the old text hight, vps is the scale factor of the selcted viewport and *factor* is a constant value wich i set to 1 for default.

    bob.at

    (setq *factor* 1.0)
    (defun c:chtext ( / A B D E F H vp)
    (Setq A (Ssget "x"))
    (Setq B (Sslength A))
    (setq vp (entget (car (entsel "\nSelect viewport: "))))
    (setq C (* (/ (cdr (assoc 41 vp)) (cdr (assoc 45 vp))) *factor*))
    (While (> B 0)
    (Setq B (1- B))
    (Setq D (Ssname A B))
    (Setq D (Entget D))
    (If (= "TEXT" (Cdr (Assoc 0 D)))
    (progn
    (Setq E (Assoc 40 D))
    (Setq H (* C (cdr E)))
    (Setq F (Cons 40 H))
    (Entmod (Setq D (Subst F E D)))
    )
    )
    )
    (Setq A nil)
    (princ "\ndone")
    )
     
    bob.at, Apr 13, 2004
    #2
    1. Advertisements

  3. cexarhos

    cexarhos Guest

    thanks,

    i will give this a try,

    appreciate the help.
     
    cexarhos, Apr 15, 2004
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.