+ Reply to Thread
Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 38
  1. #1
    Full Member autolisp's Avatar
    Using
    AutoCAD 2006
    Join Date
    Nov 2009
    Posts
    78

    Default dimension style create (plz chk my new lisp & how to improve)

    Registered forum members do not see this ad.

    dear sir
    plz chk my new lisp create dim style & how to improve
    Code:
    (defun c:dim100()
    ;check for layer and create if missing
      (if (= (tblsearch "layer" "Legend") nil)
      (command "layer" "make" "dimtest" "color" "7" "" "lt" "continuous" "" ""))
    ;check for style and create if missing
      (command "style" "style1" "arial.TTF" "0" "1" "0" "n" "n")
      (if (not (tblsearch "DImstyle" "Dim100"))
        (progn(command "dimstyle" "S" "Dim100")
          (command "dim" "style" "style1"
            "DIMADEC"   0
            "DIMALT"      0
            "DIMALTD"     3
            "DIMALTF"     0.0394
            "DIMALTRND"   0.0000
            "DIMALTTD"    3
            "DIMALTTZ"    0
            "DIMALTU"     2
            "DIMALTZ"     0
            "DIMASZ"      1.2000
            "DIMATFIT"    3
            "DIMAUNIT"    0
            "DIMAZIN"     0
            "DIMBLK"      "_Dot"
            "DIMBLK1"     ""
            "DIMBLK2"     ""
            "DIMCLRD"     8
            "DIMCLRE"     8
            "DIMCLRT"     4
            "DIMDEC"      0
            "DIMDLE"      0.0000
            "DIMDLI"      7.0000
            "DIMEXE"      2.0000
            "DIMEXO"      2.0000
            "DIMFRAC"     0
            "DIMGAP"      0.5000
            "DIMJUST"     0
            "DIMLFAC"     1.0000
            "DIMLIM"      0
            "DIMLUNIT"    2
            "DIMLWD"     9
            "DIMLWE"      9
            "DIMRND"      0.0000
            "DIMSAH"      0
            "DIMSCALE"    100.0000
            "DIMSD1"      0
            "DIMSD2"      0
            "DIMSE1"      0
            "DIMSE2"      0
            "DIMSOXD"     0
            "DIMTAD"      1
            "DIMTIH"      0
            "DIMTIX"      1
            "DIMTM"       0.0000
            "DIMTMOVE"    0
            "DIMTOFL"     1
            "DIMTOH"      0
            "DIMTSZ"      0.0000
            "DIMTVP"      0.0000
            "DIMTXSTY"    "style1"
            "DIMTXT"      2.5000
            "DIMFIT"         5 \e)
          (command "dimstyle" "S" "Dim100" "Y")))(graphscr)(princ))
    Last edited by Tiger; 28th Jul 2010 at 09:46 am. Reason: changed to code-tags

  2. #2
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    4,008

    Default

    I'm suggesting using a list of features and SETVAR function instead of that long command call:

    Code:
    (foreach SetupList '(("DIMADEC" . 0) ("DIMALT" . 0) ("DIMALTD" . 7))
     (setvar (car SetupList) (cdr SetupList))
    )

    Regards,

  3. #3
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Quote Originally Posted by autolisp View Post
    dear sir
    plz chk my new lisp create dim style & how to improve
    Code:
    (defun c:dim100()
    ;check for layer and create if missing
    (if (= (tblsearch "layer" "Legend") nil)
    (command "layer" "make" "dimtest" "color" "7" "" "lt" "continuous" "" ""))
    ;check for style and create if missing
    (command "style" "style1" "arial.TTF" "0" "1" "0" "n" "n")
    (if (not (tblsearch "DImstyle" "Dim100"))
    (progn(command "dimstyle" "S" "Dim100")
    (command "dim" "style" "style1"
    "DIMADEC" 0
    "DIMALT" 0
    "DIMALTD" 3
    "DIMALTF" 0.0394
    "DIMALTRND" 0.0000
    "DIMALTTD" 3
    "DIMALTTZ" 0
    "DIMALTU" 2
    "DIMALTZ" 0
    "DIMASZ" 1.2000
    "DIMATFIT" 3
    "DIMAUNIT" 0
    "DIMAZIN" 0
    "DIMBLK" "_Dot"
    "DIMBLK1" ""
    "DIMBLK2" ""
    "DIMCLRD" 8
    "DIMCLRE" 8
    "DIMCLRT" 4
    "DIMDEC" 0
    "DIMDLE" 0.0000
    "DIMDLI" 7.0000
    "DIMEXE" 2.0000
    "DIMEXO" 2.0000
    "DIMFRAC" 0
    "DIMGAP" 0.5000
    "DIMJUST" 0
    "DIMLFAC" 1.0000
    "DIMLIM" 0
    "DIMLUNIT" 2
    "DIMLWD" 9
    "DIMLWE" 9
    "DIMRND" 0.0000
    "DIMSAH" 0
    "DIMSCALE" 100.0000
    "DIMSD1" 0
    "DIMSD2" 0
    "DIMSE1" 0
    "DIMSE2" 0
    "DIMSOXD" 0
    "DIMTAD" 1
    "DIMTIH" 0
    "DIMTIX" 1
    "DIMTM" 0.0000
    "DIMTMOVE" 0
    "DIMTOFL" 1
    "DIMTOH" 0
    "DIMTSZ" 0.0000
    "DIMTVP" 0.0000
    "DIMTXSTY" "style1"
    "DIMTXT" 2.5000
    "DIMFIT" 5 \e)
    (command "dimstyle" "S" "Dim100" "Y")))(graphscr)(princ))

    You could try it also with entmake. See attached. Make sure the DCL and LSP are together and in the ACAD Search Support Patch. See here:http://www.cadtutor.net/forum/showth...ing-guidelines
    Attached Files

  4. #4
    Full Member autolisp's Avatar
    Using
    AutoCAD 2006
    Join Date
    Nov 2009
    Posts
    78

    Default

    Quote Originally Posted by The Buzzard View Post
    You could try it also with entmake. See attached. Make sure the DCL and LSP are together and in the ACAD Search Support Patch. See here:http://www.cadtutor.net/forum/showth...ing-guidelines
    dear sir
    thx for sharing
    1 question I select 1:100 scale
    but dim style pick 1ft.

  5. #5
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Sorry, Please take note the program is incomplete and needs more work.
    I have not had time to finish it, But it should give you some idea.
    If I get some time today I will see what I can do.

  6. #6
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Try this one.
    Attached Files

  7. #7
    Full Member autolisp's Avatar
    Using
    AutoCAD 2006
    Join Date
    Nov 2009
    Posts
    78

    Default

    Quote Originally Posted by The Buzzard View Post
    Try this one.
    dear sir
    thx for reply
    i'm using mm drg
    but same problem is there
    im select 1:100 but dimesion is come in feet

  8. #8
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Quote Originally Posted by autolisp View Post
    dear sir
    thx for reply
    i'm using mm drg
    but same problem is there
    im select 1:100 but dimesion is come in feet
    It is most likely the hard values I am using in the code.
    You could remove all the Imperial stuff and keep the metric.
    As I mentioned before, I would need some time to work out all the issues. Needs more conditionals.
    I just got to the scaling part and did not finish the rest off.


    The values would need to be changed here in this part of the code just as you would set the dimvariables.
    You could take your values and use them here. Take note that I have them identified to the right.
    Code:
    ;
    ; DimStyle Create
    ;
    (defun DSTYLE_DIMSTYLE_CREATE (DSTY$ DSCL# AH$ FSTY$)
      (if (null (tblsearch "dimstyle" DSTY$))
        (progn
          (entmake
            (list
       (cons 0 "DIMSTYLE")                                           ; Entity Type
       (cons 100 "AcDbSymbolTableRecord")                            ; Subclass marker
       (cons 100 "AcDbDimStyleTableRecord")                          ; Subclass marker
       (cons 2 DSTY$)                                                ; Dimstyle name
       (cons 70 0)                                                   ; Standard flag value
       (cons 3 "")                                                   ; DIMPOST
       (cons 4 "")                                                   ; DIMAPOST
       (cons 5  AH$)                                                 ; DIMBLK
       (cons 6  AH$)                                                 ; DIMBLK1
       (cons 7  AH$)                                                 ; DIMBLK2
       (cons 40 DSCL#)                                               ; DIMSCALE
       (cons 41 0.0937)                                              ; DIMASZ
       (cons 42 0.0937)                                              ; DIMEXO
       (cons 43 0.38)                                                ; DIMDLI
       (cons 44 0.0625)                                              ; DIMEXE
       (cons 45 0.0)                                                 ; DIMRND
       (cons 46 0.0625)                                              ; DIMDLE
       (cons 47 0.0)                                                 ; DIMTP
       (cons 48 0.0)                                                 ; DIMTM
       (cons 140 0.0937)                                             ; DIMTXT
       (cons 141 0.09)                                               ; DIMCEN
       (cons 142 0.0)                                                ; DIMTSZ
       (cons 143 25.4)                                               ; DIMALTF
       (cons 144 1.0)                                                ; DIMLFAC
       (cons 145 0.0)                                                ; DIMTVP
       (cons 146 1.0)                                                ; DIMTFAC
       (cons 147 0.0625)                                             ; DIMGAP
       (cons 71 0)                                                   ; DIMTOL
       (cons 72 0)                                                   ; DIMLIM
       (cons 73 0)                                                   ; DIMTIH
       (cons 74 0)                                                   ; DIMTOH
       (cons 75 0)                                                   ; DIMSE1
       (cons 76 0)                                                   ; DIMSE2
       (cons 77 0)                                                   ; DIMTAD
       (cons 78 3)                                                   ; DIMZIM
       (cons 170 0)                                                  ; DIMALT
       (cons 171 2)                                                  ; DIMALTD
       (cons 172 0)                                                  ; DIMTOFL
       (cons 173 0)                                                  ; DIMSAH
       (cons 174 0)                                                  ; DIMTIX
       (cons 175 0)                                                  ; DIMSOXD
       (cons 176 1)                                                  ; DIMCLRD
       (cons 177 1)                                                  ; DIMCLRE
       (cons 178 2)                                                  ; DIMCRRT
       (cons 270 4)                                                  ; DIMUNIT
       (cons 271 4)                                                  ; DIMDEC
       (cons 272 4)                                                  ; DIMTDEC
       (cons 273 2)                                                  ; DIMALTU
       (cons 274 2)                                                  ; DIMALTTD
       (cons 275 0)                                                  ; DIMAUNIT
       (cons 276 2)                                                  ; DIMFRAC
       (cons 277 4)                                                  ; DIMLUNIT
       (cons 279 2)                                                  ; DIMTMOVE
       (cons 280 0)                                                  ; DIMJUST
       (cons 281 0)                                                  ; DIMSD1
       (cons 282 0)                                                  ; DIMSD2
       (cons 283 1)                                                  ; DIMTOLJ
       (cons 284 0)                                                  ; DIMTZIN
       (cons 285 0)                                                  ; DIMALTZ
       (cons 286 0)                                                  ; DIMALTTZ
       (cons 287 5)                                                  ; DIMFIT
       (cons 288 0)                                                  ; DIMUPT
       (cons 340 (tblobjname "style" FSTY$))                         ; DIMTXSTY 
       (cons 342 (cdr (assoc 330 (entget (tblobjname "block" AH$))))); DIMLDRBLK
       (cons 343 (cdr (assoc 330 (entget (tblobjname "block" AH$))))); DIMLDRBLK1
       (cons 344 (cdr (assoc 330 (entget (tblobjname "block" AH$))))); DIMLDRBLK2
            )
          )
        )
      )
      (command "._-dimstyle" "_restore" DSTY$)                              ; Set dimstyle current
      (alert (strcat "\nThe current DimStyle name is "DSTY$"."
                     "\nThe current DimScale set to "(rtos DSCL# 2 0)"."))
    )
    ;
    ;;;/////////////////////////////////////////////////////////

  9. #9
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    I put in your values. Try DSTYLE2.lsp

    I will need to create a custom arrowhead block for the dot type arrowhead.
    Attached Files

  10. #10
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Registered forum members do not see this ad.

    Ok, We now have a custom dot arrow. What I will need from you this time is the info for your font style and that should complete it. See attached.
    Attached Files

Similar Threads

  1. Dimension Style Lisp
    By MR MAN in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 30th Dec 2012, 06:29 am
  2. help me improve the environment (create autolisp it's challange)
    By sachindkini in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 11th Jan 2010, 07:40 am
  3. Modifying Dimension Style using lisp
    By briankstan in forum AutoLISP, Visual LISP & DCL
    Replies: 19
    Last Post: 6th Aug 2009, 06:11 pm
  4. Tutorial: Create an architectural dimension style
    By AutoCAD Tips Blog in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 21st Jan 2007, 03:12 am
  5. Dimension>Style or Format>Dimension Style problem
    By jocaan in forum AutoCAD Beginners' Area
    Replies: 3
    Last Post: 21st Apr 2004, 08:50 pm

Bookmarks

Posting Permissions

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