Help with code

Discussion in 'AutoCAD' started by Aaron Cunningham, Jul 7, 2004.

  1. Robert,

    I'm still very green at creating lisp routines. I've done some digging and all I can find is:

    (setq st (tblobjname "STYLE" "ba"))

    But I know I'm going to have to add a if statment and something that will create the style if not in the drawing.

    I'm not one to ask for someone to do my own work but in this case if someone could provide me with the couple lines of code that I need it will be greatly appreciated.
     
    Aaron Cunningham, Jul 8, 2004
    #21
  2. Aaron Cunningham

    T.Willey Guest

    Aaron,

    Is "ba" the actual layer name, or is it a varaible?

    If the name then something like this:
    (if (not (tblsearch "layer" "ba")); check to see if "ba" exist
    (make layer here); if not, then make it here
    ); end the if statement

    If "ba" is a varaible (in string format) then:
    (if (not (tblsearch "layer" ba)); same except take out the quotes around ba
    (make layer here); if not, then make it here
    ); end the if statement

    Hope this helps
    Tim
     
    T.Willey, Jul 8, 2004
    #22
  3. O.k. here it is. With a little digging around today I found a way to set the text height based on dimscale. Thanks to everyone who had ideas on this one.

    (defun c:hrun ()
    (setq clr clr2)
    (setq blkx "lh8")
    (setq layx "x-wire")
    (laysetx)
    (setq blk(strcat dirlght blkx))
    (command "pline" pause pause "")
    (command "insert" blk "s" (getvar "dimscale") (getvar "lastpoint") "_endp" pause)
    (setq clr clr6)
    (setq layx "x-text")
    (laysetx)
    (if (not (tblsearch "style" "ba"))
    (command "-style" "ba" "simplex" "0" ".8" "0.0000" "n" "n" "n"))
    (SETVAR "TEXTSIZE" (* 0.09375 (if (= (GETVAR "DIMSCALE") 0) 1 (getvar "dimscale"))))
    (command "dtext" "s" "ba" pause """")
    (laybac))
     
    Aaron Cunningham, Jul 9, 2004
    #23
  4. Aaron Cunningham

    jfs4977 Guest

    Hello, I am a guy who wont to learn lisp.
    What would you recommend I start with.
    I know some, being in the field for 8 years you tend to pick up on some things but would like to learn more about the code

    Thanks
     
    jfs4977, Jul 9, 2004
    #24
  5. Aaron Cunningham

    andywatson Guest

    jfs,
    Go to AutoCAD Help->AutoLISP, VisualLISP, and DXF->AutoLISP Developer's Guide->Using the AutoLISP Language
     
    andywatson, Jul 9, 2004
    #25
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.