Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Dim Style Lisp help - where to start

  1. #1
    All AUGI, all the time gfreddog's Avatar
    Join Date
    2003-07
    Location
    Pequannock NJ US of A
    Posts
    641
    Login to Give a bone
    0

    Default Dim Style Lisp help - where to start

    I'm looking for a LISP that will reset or set (depending on your point of view) ALL of the Dim Styles in a drawing so that their:
    • Dimension Lines Color is BY LAYER
    • Extension Lines Color is BY LAYER
    • Text Appearance/Text Color is BY LAYER
    The main reason I would need this is that we use different architect's drawings as Xref's. I go into the target drawing and change the Xrefs Layers to one color so our products stand out from their backgrounds. But since the Dims are not set BY LAYER they show in their normal setting and interfere with our product details.

    I have a LISP that changes their drawings to Color By Layer but it leaves the Dims alone.

    Any ideas?

  2. #2
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: Dim Style Lisp help - where to start

    Quote Originally Posted by gfreddog View Post
    I'm looking for a LISP that will reset or set (depending on your point of view) ALL of the Dim Styles in a drawing so that their:
    • Dimension Lines Color is BY LAYER
    • Extension Lines Color is BY LAYER
    • Text Appearance/Text Color is BY LAYER
    The main reason I would need this is that we use different architect's drawings as Xref's. I go into the target drawing and change the Xrefs Layers to one color so our products stand out from their backgrounds. But since the Dims are not set BY LAYER they show in their normal setting and interfere with our product details.

    I have a LISP that changes their drawings to Color By Layer but it leaves the Dims alone.

    Any ideas?
    My idea (although it might not be a very good one) is to write a little routine that will recreate a dimensions style. This would in effect reset all current dimensions, however, the existing dimensions may still need to be updated using the update dimension command. based on my limited testing in 09, the existing dimensions are updated automatically when the dimension style is changed, including scale factors.

    here is the code I am using, you will have to substitute the settings you wish to use for the settings we use. The current program is designed to have a scale pushed through as an argument from one of our other programs, you can eliminate it, or force the user to specify the scale. The program is using dimassoc set to 1 which is why we push the scale to the dimension style.
    Code:
    (defun vcurvedim (vcurvescale / dstylename)
          
          (command "-style" "DIM" "Simplex.shx" 0 1 0 "" "" "")
          (setvar "DIMADEC" 2)        ;Angular decimal places
          (command "DIMALT" "Off")        ;Alternate units selected
          (setvar "DIMALTD" 2)        ;Alternate unit decimal places
          (setvar "DIMALTF" 25.4000)    ;Alternate unit scale factor
          (setvar "DIMALTRND" 0.0000)    ;Alternate units rounding value
          (setvar "DIMALTTD" 2)        ;Alternate tolerance decimal places
          (setvar "DIMALTTZ" 0)        ;Alternate tolerance zero suppression
          (setvar "DIMALTU" 2)        ;Alternate units
          (setvar "DIMALTZ" 0)        ;Alternate unit zero suppression
          (setvar "DIMAPOST" "")        ;Prefix and suffix for alternate text
          (setvar "DIMARCSYM" 0)        ;Arc length symbol
          (setvar "DIMASZ" 0.1500)        ;Arrow size
          (setvar "DIMATFIT" 3)        ;Arrow and text fit
          (setvar "DIMAUNIT" 1)        ;Angular unit format
          (setvar "DIMAZIN" 3)        ;Angular zero supression
          (setvar "DIMBLK" "Oblique")    ;Arrow block name
          (command "DIMBLK1" ".")        ;First arrow block name
          (command "DIMBLK2" ".")        ;Second arrow block name
          (setvar "DIMCEN" 0.0900)        ;Center mark size
          (setvar "DIMCLRD" 256)        ;Dimension line and leader color
          (setvar "DIMCLRE" 256)        ;Extension line color
          (setvar "DIMCLRT" 256)        ;Dimension text color
          (setvar "DIMDEC" 3)        ;Decimal places
          (setvar "DIMDLE" 0.0750)        ;Dimension line extension
          (setvar "DIMDLI" 0.3800)        ;Dimension line spacing
          (setvar "DIMDSEP" ".")        ;Decimal separator
          (setvar "DIMEXE" 0.0750)        ;Extension above dimension line
          (setvar "DIMEXO" 0.0625)        ;Extension line origin offset
          (setvar "DIMFRAC" 2)        ;Fraction format
          (setvar "DIMFXL" 1.0000)        ;Fixed Extension Line
          (command "DIMFXLON" "Off")    ;Enable Fixed Extension Line
          
     
        (setvar "DIMGAP" 0.0400)    ;Gap from dimension line to text
    
          (command "DIMJOGANG" 45)        ;Radius dimension jog angle
          (setvar "DIMJUST" 0)        ;Justification of text on dimension line
          (command "DIMLDRBLK" ".")        ;Leader block name
          (setvar "DIMLFAC" vcurvescale)    ;Linear unit scale factor
          (command "DIMLIM" "Off")        ;Generate dimension limits
          (command "DIMLTEX1" "")        ;Linetype extension line 1
          (command "DIMLTEX2" "")        ;Linetype extension line 2
          (command "DIMLTYPE" "")        ;Dimension linetype
          (setvar "DIMLUNIT" 2)        ;Linear unit format
          (setvar "DIMLWD" -2)        ;Dimension line and leader lineweight
          (setvar "DIMLWE" -2)        ;Extension line lineweight
          (setvar "DIMPOST" "'")        ;Prefix and suffix for dimension text
          (setvar "DIMRND" 0.0000)        ;Rounding value
          (command "DIMSAH" "Off")        ;Separate arrow blocks
          (setvar "DIMSCALE" 1.0000)    ;Overall scale factor
          (command "DIMSD1" "Off")        ;Suppress the first dimension line
          (command "DIMSD2" "Off")        ;Suppress the second dimension line
          (command "DIMSE1" "On")        ;Suppress the first extension line
          (command "DIMSE2" "On")        ;Suppress the second extension line
          (command "DIMSOXD" "Off")        ;Suppress outside dimension lines
          (setvar "DIMTAD" 1)        ;Place text above the dimension line
          (setvar "DIMTDEC" 3)        ;Tolerance decimal places
          (setvar "DIMTFAC" 1.0000)        ;Tolerance text height scaling factor
          (setvar "DIMTFILL" 1)        ;Text background enabled
          (setvar "DIMTFILLCLR" 0)        ;Text background color
          (command "DIMTIH" "Off")        ;Text inside extensions is horizontal
          (command "DIMTIX" "On")        ;Place text inside extensions
          (setvar "DIMTM" 0.0000)        ;Minus tolerance
          (setvar "DIMTMOVE" 2)        ;Text movement
          (command "DIMTOFL" "On")        ;Force line inside extension lines
          (command "DIMTOH" "Off")        ;Text outside horizontal
          (command "DIMTOL" "Off")        ;Tolerance dimensioning
          (setvar "DIMTOLJ" 1)        ;Tolerance vertical justification
          (setvar "DIMTP" 0.0000)        ;Plus tolerance
          (setvar "DIMTSZ" 0.0000)        ;Tick size
          (setvar "DIMTVP" 0.0000)        ;Text vertical position
          (setvar "DIMTXSTY" "DIM")        ;Text style
    
    
        (setvar "DIMTXT" 0.0800)    ;Text height
    
          (setvar "DIMTZIN" 0)        ;Tolerance zero suppression
          (command "DIMUPT" "Off")        ;User positioned text
          (setvar "DIMZIN" 12)        ;Zero suppression
    
    
        (setq dstylename "ENGLISHVC")
    
          (command "dimstyle"
               "save"
               dstylename
          ) ;_ end of command
        ) ;_ end of defun

  3. #3
    I could stop if I wanted to
    Join Date
    2007-05
    Location
    Brookfield WI
    Posts
    331
    Login to Give a bone
    0

    Default Re: Dim Style Lisp help - where to start

    could you select or isolate only the dimensions then run the setbylayer command?

  4. #4
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: Dim Style Lisp help - where to start

    It doesnt work because it isnt the dimension that is not by layer, it is the elements inside the dimension that are not bylayer. As an example, our dimension layer is green, but when we put in a dimension it is blue, setbylayer doesnt turn it green.

  5. #5
    I could stop if I wanted to
    Join Date
    2007-05
    Location
    Brookfield WI
    Posts
    331
    Login to Give a bone
    0

    Default Re: Dim Style Lisp help - where to start

    Quote Originally Posted by ccowgill View Post
    It doesnt work because it isnt the dimension that is not by layer, it is the elements inside the dimension that are not bylayer. As an example, our dimension layer is green, but when we put in a dimension it is blue, setbylayer doesnt turn it green.
    I see, just tossing out suggestions as I attempt to learn lisp

  6. #6
    All AUGI, all the time gfreddog's Avatar
    Join Date
    2003-07
    Location
    Pequannock NJ US of A
    Posts
    641
    Login to Give a bone
    0

    Default Re: Dim Style Lisp help - where to start

    Quote Originally Posted by ccowgill View Post
    My idea (although it might not be a very good one) is to write a little routine that will recreate a dimensions style. This would in effect reset all current dimensions, however, the existing dimensions may still need to be updated using the update dimension command. based on my limited testing in 09, the existing dimensions are updated automatically when the dimension style is changed, including scale factors.
    Hmmm I was thinking this was going to be a project and looks like it will be darn

    Ccowgill, thanks for the starting point. I'm going to use your idea and see how it goes.

    Thanks for the help

  7. #7
    Login to Give a bone
    0

    Default Re: Dim Style Lisp help - where to start

    I couldn't think of a good function name, but this should work.

    Code:
    (defun c:DSCBL (/ DimStyles@ StyleName$)
      (princ "\nDimstyles color bylayer")
      (setq StyleName$ (cdr (assoc 2 (tblnext "DIMSTYLE" t))))
      (setq DimStyles@ (list StyleName$))
      (while (setq StyleName$ (cdr (assoc 2 (tblnext "DIMSTYLE"))))
        (setq DimStyles@ (append DimStyles@ (list StyleName$)))
      );while
      (foreach StyleName$ DimStyles@
        (command "DIMSTYLE" "R" StyleName$)
        (setvar "DIMCLRD" 256);Dimension line and leader color
        (setvar "DIMCLRE" 256);Extension line color
        (setvar "DIMCLRT" 256);Dimension text color
        (command "DIMSTYLE" "S" StyleName$ "Y")
      );foreach
      (princ)
    );defun

  8. #8
    All AUGI, all the time gfreddog's Avatar
    Join Date
    2003-07
    Location
    Pequannock NJ US of A
    Posts
    641
    Login to Give a bone
    0

    Default Re: Dim Style Lisp help - where to start

    Quote Originally Posted by Terry Cadd View Post
    I couldn't think of a good function name, but this should work.

    Code:
    (defun c:DSCBL (/ DimStyles@ StyleName$)
      (princ "\nDimstyles color bylayer")
      (setq StyleName$ (cdr (assoc 2 (tblnext "DIMSTYLE" t))))
      (setq DimStyles@ (list StyleName$))
      (while (setq StyleName$ (cdr (assoc 2 (tblnext "DIMSTYLE"))))
        (setq DimStyles@ (append DimStyles@ (list StyleName$)))
      );while
      (foreach StyleName$ DimStyles@
        (command "DIMSTYLE" "R" StyleName$)
        (setvar "DIMCLRD" 256);Dimension line and leader color
        (setvar "DIMCLRE" 256);Extension line color
        (setvar "DIMCLRT" 256);Dimension text color
        (command "DIMSTYLE" "S" StyleName$ "Y")
      );foreach
      (princ)
    );defun
    Egads that works too!

    I called it DCBL (Dims Color By Layer)

    Thanks everyone for the help AGAIN!

    Have I told you all lately that AUGI Rocks? Well it does!

  9. #9
    I could stop if I wanted to CadDog's Avatar
    Join Date
    2005-06
    Location
    So Ca
    Posts
    439
    Login to Give a bone
    0

    Default Re: Dim Style Lisp help - where to start

    Quote Originally Posted by gfreddog View Post
    Egads that works too!

    I called it DCBL (Dims Color By Layer)

    Thanks everyone for the help AGAIN!

    Have I told you all lately that AUGI Rocks? Well it does!
    Code:
    First pass with a few if statements...
    ((= scl es10)
    (if (= jw_vptog 1)(mvp))
    (if (= jw_vptog 1)(command "mspace" "zoom" "1/10xp" "pspace"))
    (if (= jw_vptog 1)(mvpoff))
    (if (= jw_sctog 1)(scv))
    (if (= jw_sctog 1)(command "zoom" "1/10xp" "pspace"))
    (if (= jw_sctog 1)(scvoff))
    (if (= jw_sfont 1)(f_s))
    (if (= jw_sfont 1)(f_soff))
    (if (= jw_efont 1)(f_e))
    (if (= jw_efont 1)(f_eoff)) 
    (set_v)(ds_engin)(sv_std)(es10)(msoff)(dimassocheck))
    
    then it goes to (as you can see above) to:
    
    (defun es10 ()
            (setq jkwds 10)
      	(setq jkwsth (* jkwds ddsth))
      	(setq jkwdss (vl-princ-to-string jkwds))
      	(setq jkwdst (strcat "dim" jkwdss))
    
    	(Command "USERS5" "MS Scale: 1\"= 10'")
    	(DialogCreate (strcat DialogLayer "0010") DialogColor)
    
    	(command "USERR1" jkwds "USERR2" jkwsth "USERR4" jkwds "USERI5" "0" "USERR5" "2")
    	(if (= jw_pvptog 1)(jkwvb))
    	(if (= tm 1)(command "ltscale" jkwds "textsize" jkwsth "dimscale" jkwds "dimstyle" "save" jkwdst))
    	(if (= tm 0)(command "ltscale" "1" "textsize" ddsth "dimlfac" "1" "dimscale" "1" "dimstyle" "save" jkwdst)))
    
    then...
    
    (defun set_v ()
       (command
    "dimstyle" 	"r"
    "standard" 	"dim"
    "dimadec" 	"0"
    "dimalt" 	"0"
    "dimaltd" 	"2"
    "dimaltf" 	"25.4"
    "dimaltrnd"	"0"
    "dimalttd" 	"2"
    "dimalttz" 	"0"
    "dimaltu" 	"2"
    "dimaltz" 	"0"
    ;"dimaso" 	"1"
    "dimassoc" 	"1" ;Was giving troble when files were updated so we changed to 1 (On dim assoc)
    "dimasz" 	".15"
    "dimatfit" 	"3"
    "dimazin" 	"0"
    "dimblk" 	"."
    "dimblk1" 	"."
    "dimblk2" 	"."
    "dimcen" 	".062"
    "dimclrd" 	"bylayer"
    "dimclre" 	"bylayer"
    "dimclrt" 	DialogColorText
    "dimdec" 	"2"
    "dimdle" 	".062"
    "dimdli" 	"0"
    "dimdsep" 	"."
    "dimexe" 	".062"
    "dimexo" 	".062"
    "dimfit" 	"5"
    "dimgap" 	".062"
    "dimjust" 	"0"
    "dimldrblk" 	"."
    "dimlfac" 	"1"
    "dimlim" 	"0"
    "dimlwd" 	"-2"
    "dimlwe" 	"-2"
    "dimrnd" 	"0"
    "dimsah" 	"0"
    "dimsho" 	"1"
    "dimsoxd" 	"0"
    "dimtad" 	"1"
    "dimtdec" 	"4"
    "dimtfac" 	"1"
    "dimtih" 	"0"
    "dimtix" 	"0"
    "dimtm" 	"0"
    "dimtmove" 	"1"
    "dimtofl" 	"1"
    "dimtoh" 	"0"
    "dimtol" 	"0"
    "dimtolj" 	"1"
    "dimtp" 	"0"
    "dimtsz" 	"0"
    "dimtvp" 	"0"
    "dimtxsty" 	"text"
    "dimtxt" 	ddsth
    "dimtzin" 	"0"
    "dimupt" 	"0"
    "dimzin" "3" "")(COMMAND))
    There are a few more steps but I hope you get the idea...
    This program not only set the dim style but it also remembers and notes the setting of the drawing when you reopen it again by using these other ver:

    ;;; "useri1" is used to check if Imperial (0) or Metric (2) standards.
    ;;; "useri5" is used to check which type of graphic scale to use. "Set within (GrScale.lsp)

    ;;; "userr1" is used to store dimscale and ltscale for MS.
    ;;; "userr2" is used to store textsize for MS.
    ;;; "userr3" is used to store variable for a Drawing to be compare by ClientMenuCheck.lsp. ;is used to store dimlfac for PS in 14
    ;;; "userr4" is used to store dimscale for MS
    ;;; "userr5" is set in the menu.mnl and compared with userr3 set DDS to display on the status line in AutoCAD.
    ;;; "userr5" is set for check which space the use is in and if they are using Arch or Engineering scale. 1 = Arch 2=Engineering 6/1/06

    ;;; "users1" is used for Projest Name
    ;;; "users2" is for storing variable for LastBlockName "See line 41 on Corp2k-Org.mnl"
    ;;; "users5" is used to store which MS scale selected.

    The scale I have shown is the 1" = 10' but the program is the same for any and all the scales.

    I hope this helps a little more...

    Attached Images Attached Images

  10. #10
    Member
    Join Date
    2008-03
    Posts
    2
    Login to Give a bone
    0

    Talking Re: Dim Style Lisp help - where to start

    Quote Originally Posted by Terry Cadd View Post
    I couldn't think of a good function name, but this should work.

    Code:
    (defun c:DSCBL (/ DimStyles@ StyleName$)
      (princ "\nDimstyles color bylayer")
      (setq StyleName$ (cdr (assoc 2 (tblnext "DIMSTYLE" t))))
      (setq DimStyles@ (list StyleName$))
      (while (setq StyleName$ (cdr (assoc 2 (tblnext "DIMSTYLE"))))
        (setq DimStyles@ (append DimStyles@ (list StyleName$)))
      );while
      (foreach StyleName$ DimStyles@
        (command "DIMSTYLE" "R" StyleName$)
        (setvar "DIMCLRD" 256);Dimension line and leader color
        (setvar "DIMCLRE" 256);Extension line color
        (setvar "DIMCLRT" 256);Dimension text color
        (command "DIMSTYLE" "S" StyleName$ "Y")
      );foreach
      (princ)
    );defun
    Thanks Terry CADD, that was just what I needed.
    I was having a hard time figuring out how to build the dimstyle list to iterate through them.
    Had not seen tblnext before.

Page 1 of 2 12 LastLast

Similar Threads

  1. Quick start with style?
    By cadman_meg in forum AutoCAD Civil 3D - General
    Replies: 3
    Last Post: 2008-05-02, 11:54 PM
  2. Start with Named Plot Style Table 's Drawing
    By Jack Cheong in forum AutoCAD General
    Replies: 10
    Last Post: 2008-03-31, 02:37 PM
  3. Learning how to use Reactors in LISP, where to start
    By rajat_bapi_mallick in forum AutoLISP
    Replies: 2
    Last Post: 2007-05-25, 03:05 AM
  4. Loading lisp code at start up
    By cadd4la in forum AutoLISP
    Replies: 4
    Last Post: 2006-01-31, 04:45 PM
  5. Start Up Lisp Help
    By BCrouse in forum AutoLISP
    Replies: 7
    Last Post: 2005-04-20, 03:52 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
  •