Set the layer lineweight ...hmmm

Discussion in 'AutoCAD' started by Dave Mullins, Dec 8, 2004.

  1. Dave Mullins

    Dave Mullins Guest

    (command "layer" "make" "stepping stone" "color" "90" "" "lw" ".30" "")

    it appears that cad will not let me assign the lineweight as I have.
    the line works great until i try setting a lineweight. GRRR
    Is the decimal is causing the huccup?

    it belongs to a script I obtained here too, just modified....in a messy
    way...
    -----------------
    (defun c:ss ( / );draws stepping stones
    (command "layer" "make" "stepping stone" "color" "90" "" "")
    (print "Draw Outline of Stepping Stone, be sure to TYPE C TO close
    polyLINE." )
    (setvar "cmdecho" 0)
    (command "_.pline")
    (while (= (logand (getvar "CMDACTIVE") 1) 1)
    (vl-cmdf pause) )
    (command "layer" "make" "stepping stone hatch" "color" "9" "" "")
    (command ".-bhatch" "p" "DOTS" "12" "0" "a" "a" "y" "" "s" "l" "" "")
    (princ) )
    ---------------

    I have been entertaining the idea of logging the current layer before
    the start of the routine, and returning that layer to current afterward,
    but have no idea what to do, may I also ask for assistance with that?

    Thanks in advance

    Dave
     
    Dave Mullins, Dec 8, 2004
    #1
  2. Dave Mullins

    Dave Mullins Guest

    I found something for the layer preservation and restoration, but the
    lineweight is still putting up a fight.


    (defun c:ss ( / );draws stepping stones
    (setq OldLayer (getvar "CLAYER"))
    (command "layer" "make" "stepping stone" "color" "90" "" "")
    (print "Draw Outline of Stepping Stone, be sure to TYPE C TO close
    polyLINE." )
    (setvar "cmdecho" 0)
    (command "_.pline")
    (while (= (logand (getvar "CMDACTIVE") 1) 1)
    (vl-cmdf pause) )
    (command "layer" "make" "stepping stone hatch" "color" "9" "" "")
    (command ".-bhatch" "p" "DOTS" "12" "0" "a" "a" "y" "" "s" "l" "" "")
    (setvar "CLAYER" OldLayer)
    (princ) )
     
    Dave Mullins, Dec 8, 2004
    #2
  3. Dave Mullins

    OLD-CADaver Guest

    try adding a zero in front of the decimal point "0.30"
     
    OLD-CADaver, Dec 8, 2004
    #3
  4. Dave Mullins

    Jeff Mishler Guest

    This works for me. Note the second "" at the end and the -layer to force the
    use of the command line version.

    (command "-layer" "make" "stepping stone" "color" "90" "" "lw" ".30" "" "")
     
    Jeff Mishler, Dec 8, 2004
    #4
  5. Dave Mullins

    Don I Guest

    I was doing something like this last week and I seem to remember having to
    represent the weight as a STRING.

    Whereas weight .30 would be represented as 030mm (I think that's what it
    was). Acommand line type:
    -layer
    lw
    ALayerName
    Notice the prompt here. Take note of how it wants you to enter a lineweight
    of zero.
     
    Don I, Dec 8, 2004
    #5
  6. Dave Mullins

    Dave Mullins Guest

    That did the trick. Funny how simple things slide past!

    Thank you, I appreciate your help.

    Here's what it ended up looking like, in case somebody wants to rename
    it and use it to draw anything else.
    .....draws a polyline, (that the user must close) and fills it with a
    hatch pattern.

    My next step is to figure out how revcloud closes when you get close to
    the start point, and do that with this to make it foolproof.

    -----------------
    (defun c:ss ( / );draws stepping stones
    (setq OldLayer (getvar "CLAYER"))
    (command "-layer" "make" "stepping stone" "color" "90" "" "lw" ".30" "" "")
    (print "Draw Outline of Stepping Stone, be sure to TYPE C TO close
    polyLINE." )
    (setvar "cmdecho" 0)
    (command "_.pline")
    (while (= (logand (getvar "CMDACTIVE") 1) 1)
    (vl-cmdf pause) )
    (command "-layer" "make" "stepping stone hatch" "color" "9" "" "lw"
    ".09" "" "")
    (command ".-bhatch" "p" "DOTS" "12" "0" "a" "a" "y" "" "s" "l" "" "")
    (setvar "CLAYER" OldLayer)
    (princ) )
     
    Dave Mullins, Dec 8, 2004
    #6
  7. Dave Mullins

    RDI Guest

    I was mistaken. Sorry.
     
    RDI, Dec 8, 2004
    #7
  8. Dave Mullins

    GaryDF Guest

    Give this one a try..........

    Gary

    ;;; stepping stones
    ;;; by Gary Fowler
    ;;;
    ;;; 12/11/04
    ;;; global var = ARCH#LAST
    ;;; uses parts of Autodesk revcloud function
    ;;; to modify setting change ACET-REVCLOUD-BULGE and NC_ANGLE

    (defun ARCH:Stepping-Stone (/ CLayer ARC_LENGTH DIM_SCALE ARC_STYLE LAST_PT
    NEXT_PT READTYP
    READVAL INC_ANGLE START_PT SAVED_EN LA LC LW LT)
    (defun ARCH:NYLER (LA LC LT LW)
    (setvar "cmdecho" 0)
    (if (tblsearch "layer" LA)
    (progn (command "layer" "t" LA "") (command "layer" "s" LA ""))
    (progn (command "layer" "m" LA)
    (command "c" LC "" "lt" LT "" "lw" LW "" "")))
    (command "cecolor" "bylayer")
    (setvar "cmdecho" 1)
    (princ))
    (setq CLayer (getvar "CLAYER"))
    (ARCH:NYLER "A-ROCK" "90" "continuous" "0.16")
    ;;begin Autodesk revcloud function
    (setenv "ACET-REVCLOUD-BULGE" (rtos (* (getvar "dimscale") 2.0) 2 2))
    (setq ARC_LENGTH (distof (getenv "ACET-REVCLOUD-BULGE")))
    (setq INC_ANGLE 25
    ARC_LENGTH
    (distof (getenv "ACET-REVCLOUD-BULGE"))
    DIM_SCALE
    (if (= (getvar "DIMSCALE") 0)
    1
    (getvar "DIMSCALE"))
    ARC_STYLE
    (getenv "ACET-REVCLOUD-STYLE")
    LOOP T)
    (setq LAST_PT (GetPoint "\n* Specify Stepping Stone Starting Point <Draw
    counterclockwise...> *"))
    (setq ARCH#LAST LAST_PT)
    (if LAST_PT
    (progn (setq START_PT LAST_PT
    SAVED_EN (entlast))
    (Prompt "\n* Guide Crosshairs along Stepping Stone Outline <Sim to
    Revcloud routine>...*")
    (Command "_.pline" LAST_PT "_a" "_a" INC_ANGLE LAST_pt "_a"
    INC_ANGLE)))
    (While LAST_PT
    (Setq NEXT_PT (GrRead 1)
    READTYP (car NEXT_PT)
    READVAL (cadr NEXT_PT))
    (cond ((or (= 5 READTYP) (= 3 READTYP))
    (setq NEXT_PT (cadr NEXT_PT))
    (if (or (> (distance LAST_PT NEXT_PT) ARC_LENGTH) (= READTYP 3))
    (Progn (Command NEXT_PT "_a" INC_ANGLE) (Setq LAST_PT NEXT_PT))
    (Progn (command NEXT_PT "_u") (command "_a" INC_ANGLE)))
    (if (> (Distance LAST_PT NEXT_PT) (Distance START_PT NEXT_PT))
    (Progn (Command START_PT "_cl")
    (Setq LAST_PT Nil)
    (prompt "\n* Stepping Stone
    completed.....................*"))))
    ((and (= 11 READTYP) (= 0 READVAL))
    (command LAST_PT "_u" "")
    (Setq LAST_PT Nil))
    ((and (= 2 READTYP) (or (= 13 READVAL) (= 32 READVAL)))
    (command LAST_PT "_u" "")
    (Setq LAST_PT Nil))
    (T (prompt "\n* Move the pointer to Draw Stepping Stone *"))))
    ;;end of Autodesk revcloud function
    (ARCH:NYLER "A-PATT" "9" "continuous" "0.08")
    (command ".-bhatch" "p" "DOTS" "12" "0" "a" "a" "y" "" "s" "l" "" "")
    (setvar "CLAYER" CLayer)
    (Princ))
    ;;;
    (defun C:STONE ()
    (prompt "\n* Draw Stepping Stones [Routine will repeat until an <Enter>] *")
    (ARCH:Stepping-Stone)
    (while (/= ARCH#LAST nil) (ARCH:Stepping-Stone)))
    (princ "\n* Enter \"STONE\" at the command line *")
    (princ)
     
    GaryDF, Dec 13, 2004
    #8
  9. Dave Mullins

    Dave Mullins Guest

    Wow, I forgot about this post, until I started using it to make a shrub
    routine for a friend's company.
    They need several types of plant materials (different hatch patterns for
    different plants), so I added a revision cloud (the lazy way) just
    started making copies, and changing the hatch patterns.
    THAT said, Gary, thanks for the additional contribution.
    That routine DOES work, but it is not controlled enough. IE, the
    polyline allows one to select points specifically. say it's a long
    hedge following a foundation, the revcloud function allows a bit of
    variance while guiding the cursor, and sometimes becomes a PITA to keep
    a straight line, (they're a bit picky) the poly eliminates that,
    because the user just picks start and end points until the end and
    closes the poly.
    My goal was to have the poly close similar to the way revcloud does, not
    revert to the revcloud.
    anyway, I do appreciate your post...
    THANKS
    Here's what it looks like if anyone wants it....it'll need to be
    modified if you still use color plot styles and not named plot styles.
    Just change the number after the "Color" in 2 places to meet your needs

    ------
    (defun c:SSA ( / )
    ;user defines outline of area with a polyline,
    ;polyline is converted to revcloud on predefined layer
    ;revcloud is filled with a hatch on predefined layer
    (setq OldLayer (getvar "CLAYER"))
    (command "-layer" "make" "SHRUB OUTLINES" "color" "4" "" "lw" ".20" ""
    "PSTYLE" "MEDIUM" "" "")
    (print "Draw Outline of Shrub Mass Type #1, be sure to TYPE C TO close
    polyLINE." )
    (setvar "cmdecho" 0)
    (command "_.pline")
    (while (= (logand (getvar "CMDACTIVE") 1) 1)
    (vl-cmdf pause) )
    (command "REVCLOUD" "a" "8" "8" "" "last" "")
    (command "-layer" "make" "SHRUB HATCH" "color" "10" "" "lw" ".05" ""
    "PSTYLE" "FINE" "" "")
    (command ".-bhatch" "p" "GENERAL_CHECKEREDPLATE" "4" "90" "a" "a" "y"
    "" "s" "l" "" "")
    (setvar "CLAYER" OldLayer)
    (princ) )
    ------
     
    Dave Mullins, Jan 29, 2005
    #9
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.