Jump to content

Help with entmake


woodman78

Recommended Posts

I am using entmake to create textstyle and dimstyle in a drawing but I get the following when I try to assign a textstyle to the dimstyle. How do I get around this?

 

Do I set the textstyle as current in the entmake for textstyle and then not worry about it for the dimstyle.

 

 
(defun c:cdim ()
 (if (null (tblsearch "STYLE" "CCC_Doer"))
   (entmake
     (list
       (cons 0 "STYLE")
       (cons 100 "AcDbSymbolTableRecord")
       (cons 100 "AcDbTextStyleTableRecord")
       (cons 2 "CCC_Doer")
       (cons 3 "Verdana.ttf")
       (cons 40 0)
       (cons 70 0))))
(if (null (tblsearch "DIMSTYLE" "CCC_Doer_Cross_Sections"))
         (entmake
     (list
       (cons 0 "DIMSTYLE")
       (cons 100 "AcDbDIMStyleTableRecord")
       (cons 2 "CCC_Doer_Cross_Sections") ;DimStyleName
       (cons 3 "m")                  ;Dimpost
       (cons 4 "")                  ;Dimapost
       (cons 40 1)                  ;Dimscale
       (cons 41 0.30)               ;Dimasz
       (cons 42 0.20)               ;Dimexo
       (cons 43 0.38)               ;Dimdli
       (cons 44 0.25)               ;Dimexe
       (cons 45 0)                ;Dimrnd
       (cons 46 0)                ;Dimdle
       (cons 47 0)                ;Dimtp
       (cons 48 0)                ;Dimtm
       (cons 140 0.25)               ;Dimtxt
       (cons 141 0.09)               ;Dimcen
       (cons 142 0)                ;Dimtsz
       (cons 143 25.4)               ;Dimaltf
       (cons 144 1.00)               ;Dimlfac
       (cons 145 0)                ;Dimtvp        
       (cons 146 1.00)               ;Dimtfac
       (cons 147 0.09)               ;Dimgap
       (cons 148 0)                ;Dimaltrnd
       (cons 71 0)                ;Dimtol     
       (cons 72 0)                ;Dimlim
       (cons 73 1)               ;Dimtih
       (cons 74 1)               ;Dimtoh
       (cons 75 0)               ;Dimse1
       (cons 76 0)               ;Dimse2
       (cons 77 0)                ;Dimtad
       (cons 78 0)                ;Dimzin
       (cons 79 0)                ;Dimazin
       (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 256)               ;Dimclrd
       (cons 177 256)               ;Dimclre
       (cons 178 256)               ;Dimclrt
       (cons 179 2)                ;Dimadec
       (cons 271 3)                ;Dimdec
       (cons 272 2)                ;Dimtdec
       (cons 273 2)                ;Dimaltu
       (cons 274 2)                ;Dimalttd
       (cons 275 0)                ;Dimaunit
       (cons 276 0)                ;Dimfrac
       (cons 277 2)                ;Dimlunit
       (cons 278 0)               ;Dimdsep
       (cons 279 0)                ;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 288 0)               ;Dimupt
       (cons 289 3)                ;Dimatfit
;        (cons 340 "CCC_DOER")              ;Dimtxsty
       (cons 341 0)                ;Dimldrblk
       (cons 342 0)                ;Dimblk
       (cons 343 0)                ;Dimblk1
       (cons 344 0)                ;Dimblk2
       (cons 371 -1)               ;Dimlwd
       (cons 372 -1))))               ;Dimlwe
)

Link to comment
Share on other sites

  • Replies 22
  • Created
  • Last Reply

Top Posters In This Topic

  • The Buzzard

    10

  • woodman78

    9

  • TimSpangler

    3

  • Lee Mac

    1

I am using entmake to create textstyle and dimstyle in a drawing but I get the following when I try to assign a textstyle to the dimstyle. How do I get around this?

 

Do I set the textstyle as current in the entmake for textstyle and then not worry about it for the dimstyle.

 

 
(defun c:cdim ()
 (if (null (tblsearch "STYLE" "CCC_Doer"))
   (entmake
     (list
       (cons 0 "STYLE")
       (cons 100 "AcDbSymbolTableRecord")
       (cons 100 "AcDbTextStyleTableRecord")
       (cons 2 "CCC_Doer")
       (cons 3 "Verdana.ttf")
       (cons 40 0)
       (cons 70 0))))
(if (null (tblsearch "DIMSTYLE" "CCC_Doer_Cross_Sections"))
         (entmake
     (list
       (cons 0 "DIMSTYLE")
       (cons 100 "AcDbDIMStyleTableRecord")
       (cons 2 "CCC_Doer_Cross_Sections") ;DimStyleName
       (cons 3 "m")                  ;Dimpost
       (cons 4 "")                  ;Dimapost
       (cons 40 1)                  ;Dimscale
       (cons 41 0.30)               ;Dimasz
       (cons 42 0.20)               ;Dimexo
       (cons 43 0.38)               ;Dimdli
       (cons 44 0.25)               ;Dimexe
       (cons 45 0)                ;Dimrnd
       (cons 46 0)                ;Dimdle
       (cons 47 0)                ;Dimtp
       (cons 48 0)                ;Dimtm
       (cons 140 0.25)               ;Dimtxt
       (cons 141 0.09)               ;Dimcen
       (cons 142 0)                ;Dimtsz
       (cons 143 25.4)               ;Dimaltf
       (cons 144 1.00)               ;Dimlfac
       (cons 145 0)                ;Dimtvp        
       (cons 146 1.00)               ;Dimtfac
       (cons 147 0.09)               ;Dimgap
       (cons 148 0)                ;Dimaltrnd
       (cons 71 0)                ;Dimtol     
       (cons 72 0)                ;Dimlim
       (cons 73 1)               ;Dimtih
       (cons 74 1)               ;Dimtoh
       (cons 75 0)               ;Dimse1
       (cons 76 0)               ;Dimse2
       (cons 77 0)                ;Dimtad
       (cons 78 0)                ;Dimzin
       (cons 79 0)                ;Dimazin
       (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 256)               ;Dimclrd
       (cons 177 256)               ;Dimclre
       (cons 178 256)               ;Dimclrt
       (cons 179 2)                ;Dimadec
       (cons 271 3)                ;Dimdec
       (cons 272 2)                ;Dimtdec
       (cons 273 2)                ;Dimaltu
       (cons 274 2)                ;Dimalttd
       (cons 275 0)                ;Dimaunit
       (cons 276 0)                ;Dimfrac
       (cons 277 2)                ;Dimlunit
       (cons 278 0)               ;Dimdsep
       (cons 279 0)                ;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 288 0)               ;Dimupt
       (cons 289 3)                ;Dimatfit
;        (cons 340 "CCC_DOER")              ;Dimtxsty
       (cons 341 0)                ;Dimldrblk
       (cons 342 0)                ;Dimblk
       (cons 343 0)                ;Dimblk1
       (cons 344 0)                ;Dimblk2
       (cons 371 -1)               ;Dimlwd
       (cons 372 -1))))               ;Dimlwe
)

You are getting this error because you also need to create the leader block with entmake before you set the dimstyle.

 

; error: bad DXF group: (341 . 0)

 

The value 0 you are using is no good, Need also to give the leader block handle as well.

(cons 341 0) ;Dimldrblk This is no good

 

After this is fixed, You most likely will have problems with other values as well.

 

See post 3 by Tim Spangler in this thread it should have everything you need: http://www.cadtutor.org/forum/showthread.php?t=35584

Link to comment
Share on other sites

Buzzard,

I have tried modifying the LISP by Tim Spangler but I keep getting a "too few arguments" error. Is it something to do with the section that creates the "dimblk"??

ccccdim.lsp

Link to comment
Share on other sites

Buzzard,

I have tried modifying the LISP by Tim Spangler but I keep getting a "too few arguments" error. Is it something to do with the section that creates the "dimblk"??

 

Thats because of the way the program is setup. You need to supply the four arguments highlighted in red in that order. The program was setup as a local function.

 

 

(defun STDLIB_CREATE_DIMSTYLE ([color="Red"]StyleName StyleScale TextStyle Current[/color] / OldDimBlk OldCmdEcho StyleScale TextStyle)

Link to comment
Share on other sites

Buzzard I hvae tried calling Tim's lisps without editing them using the following but I get no joy...

 

 
(defun c:STBDIM ()
STDLIB_CREATE_TEXTSTYLE ("CCC_DOER" 0.25 "verdana.ttf" T)
STDLIB_CREATE_DIMSTYLE ("CCC_DOER_DIMS" 1 "CCC_DOER" T)
(princ)
)

 

Am I way off the mark??

Link to comment
Share on other sites

woodman,

 

I made a simple program with the arguments to run with Tims programs.

1. Keep all three programs below together.

2. Load only the DS.lsp, It will load the other two for you.

3. Type DS, It should put in a dimstyle called ARCH and set it current. It will create a textstyle called SIMPLEX.

 

Make sure you use all three programs.

 

After you see it I am sure you will get the idea. What you do with it later is on you.

DS.LSP

STDLIB_CREATE_DIMSTYLE.LSP

STDLIB_CREATE_TEXTSTYLE.lsp

Link to comment
Share on other sites

Buzzard I hvae tried calling Tim's lisps without editing them using the following but I get no joy...

 

 
(defun c:STBDIM ()
[color="red"][size="5"]([/size][/color]STDLIB_CREATE_TEXTSTYLE ("CCC_DOER" 0.25 "verdana.ttf" T)[size="5"][color="Red"])[/color][/size]
[size="5"][color="red"]([/color][/size]STDLIB_CREATE_DIMSTYLE ("CCC_DOER_DIMS" 1 "CCC_DOER" T)[color="red"][size="5"])[/size][/color]
(princ)
)

 

Am I way off the mark??

 

Not off the mark, just forgetting the ()

Link to comment
Share on other sites

Not off the mark, just forgetting the ()

 

Need also to remove whats in red.

 

(defun c:STBDIM ()
(STDLIB_CREATE_TEXTSTYLE [color="red"]([/color]"CCC_DOER" 0.25 "verdana.ttf" T)[color="Red"])[/color]
(STDLIB_CREATE_DIMSTYLE [color="Red"]([/color]"CCC_DOER_DIMS" 1 "CCC_DOER" T)[color="red"])[/color]
(princ)
)

 

woodman,

Make sure you load the other two programs at the same time or use this below.

 

(defun c:STBDIM ()
 (load "STDLIB_CREATE_DIMSTYLE")
 (load "STDLIB_CREATE_TEXTSTYLE")
 (STDLIB_CREATE_TEXTSTYLE "CCC_DOER" 0.25 "verdana.ttf" T)
 (STDLIB_CREATE_DIMSTYLE  "CCC_DOER_DIMS" 1 "CCC_DOER" T)
(princ)
)

Link to comment
Share on other sites

Need also to remove whats in red.

 

(defun c:STBDIM ()
(STDLIB_CREATE_TEXTSTYLE [color="red"]([/color]"CCC_DOER" 0.25 "verdana.ttf" T)[color="Red"])[/color]
(STDLIB_CREATE_DIMSTYLE [color="Red"]([/color]"CCC_DOER_DIMS" 1 "CCC_DOER" T)[color="red"])[/color]
(princ)
)

 

)[/code]

 

Yeah what he said.....good catch I didn't even notice those.

Link to comment
Share on other sites

Yeah what he said.....good catch I didn't even notice those.

It would still work Tim, But I did not see the need for it.

Link to comment
Share on other sites

[color=Red][b]([/b][/color][color=Green][b][color=Blue]symbol1[/color] symbol2 ... symbolN[/b][/color][color=Red][b])[/b][/color]

symbol1 evaluated as a function, symbol2,...,symbolN taken as arguments for function symbol1.

 

[color=DarkRed][b]'[/b][/color][color=Red][b]([/b][/color][b][color=Green]symbol1 symbol2 ... symbolN[/color][/b][b][color=Red])[/color][/b]

symbol1,...,symbolN not evaluated, expression is a list of symbols.

 

[b][color=Red]([/color][color=Blue]list[/color][/b] [b][color=Green]symbol1 symbol2 ... symbolN[/color][color=Red])[/color][/b]

symbol1,...,symbol2 evaluated as arguments for the list function.

 

[color=Red][b]([/b][/color][color=Blue][b]apply[/b][/color] '[b][color=Green]foo [/color][/b]'[b][color=Red]([/color][color=Green]symbol1 symbol2 ... symbolN[/color][/b][b][color=Red]))[/color][/b]

symbol1,...,symbolN taken as arguments for function foo. foo is not evaluated but taken as an argument for apply. symbol1,...,symbolN unevaluated and taken as a list of symbols.

 

[color=Red][b]([/b][/color][color=Blue][b]eval[/b][/color] [b][color=Red]([/color][color=Blue]cons[/color][/b] '[color=Green][b]foo[/b][/color] '[color=Red][b]([/b][/color][b][color=Green]symbol1 symbol2 ... symbolN[/color][/b][b][color=Red])))[/color][/b]

Unevaluated list of symbols evaluated by eval, symbol1,...,symbolN taken as arguments for function foo as above.

Link to comment
Share on other sites

It shouldn't work. It would look at the arguments as a separate function with arguments?

Ok Tim,

 

I fixed the post.

Link to comment
Share on other sites

Thanks guys for the advice. I removed the brackets from the lisp I had and it worked. I had already loaded the textstyle and dimstyle create routines using acaddoc.lsp.

 

Great stuff thanks again.

Link to comment
Share on other sites

I am trying to change the arrow type from Oblique to Closed Filled but not having much success. Everything I do I get an error saying that the block needs to be defined first.

 

Anyone any ideas??

Link to comment
Share on other sites

I am trying to change the arrow type from Oblique to Closed Filled but not having much success. Everything I do I get an error saying that the block needs to be defined first.

 

Anyone any ideas??

Try this: "."

 

Type: String
Saved in: Drawing
Initial value: "" 

Sets the arrowhead block displayed at the ends of dimension lines or leader lines. To return to the default, closed-filled arrowhead display, enter a single period (.). Arrowhead block entries and the names used to select them in the New, Modify and Override Dimension Style dialog boxes are shown below. You can also enter the names of user-defined arrowhead blocks.

"" closed filled 
"_DOT" dot 
"_DOTSMALL" dot small 
"_DOTBLANK" dot blank 
"_ORIGIN" origin indicator 
"_ORIGIN2" origin indicator 2 
"_OPEN" open 
"_OPEN90" right angle 
"_OPEN30" open 30 
"_CLOSED" closed 
"_SMALL" dot small blank 
"_NONE" none 
"_OBLIQUE" oblique 
"_BOXFILLED" box filled 
"_BOXBLANK" box 
"_CLOSEDBLANK" closed blank 
"_DATUMFILLED" datum triangle filled 
"_DATUMBLANK" datum triangle 
"_INTEGRAL" integral 
"_ARCHTICK" architectural tick 

Link to comment
Share on other sites

That didn't work Buzzard, this is what I got

 

"; error: bad argument type: lentityp nil"

 

 
;;; ------------------------------------------------------------------------
;;;    STDLIB_CREATEDIMSTYLE.LSP
;;;
;;;    Copyright © December, 2008
;;;    Timothy G. Spangler
;;;
;;;    Permission to use, copy, modify, and distribute this software
;;;    for any purpose and without fee is hereby granted, provided
;;;    that the above copyright notice appears in all copies and
;;;    that both that copyright notice and the limited warranty and
;;;    restricted rights notice below appear in all supporting
;;;    documentation.
;;;
;;;    STDLIB_CREATE_DIMSTYLE
;;;
;;;   Description:
;;;   Called from a menu pulldown or rightclick menu
;;;  * (STDLIB_CREATE_DIMSTYLE <STYLENAME> <DIMSCALE> <TEXTSTYLE> <CURRENT>)
;;;  <STYLENAME> = STRING = Name of dimstyle to be created
;;;  <DIMSCALE>  = REAL  = Dimscale
;;;  <TEXTSTYLE> = STRING = Valid textstyle name
;;;  <CURRENT>   = BOOLE = If T then it set the created layer current
;;;
;;;   Returns:
;;;
;;; ------------------------------------------------------------------------
;;; MAIN FUNCTION ;;;;;;;;;;;;;;;;;;;;;;;;;
(defun STDLIB_CREATE_DIMSTYLE (StyleName StyleScale TextStyle Current / OldDimBlk OldCmdEcho StyleScale TextStyle)

;; Check arguments
(if (not StyleScale)
 (setq StyleScale 1.0)
)
(if (not TextStyle)
 (setq TextStyle (getvar "TEXTSTYLE"))
)
;; Create dimstyle
(if (not (tblsearch "DIMSTYLE" StyleName))
 (progn
  ;; Set echo
  (setq OldCmdEcho (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  
  ;; Create textstyle
  ;;; STD LIB Function
  (STDLIB_CREATE_TEXTSTYLE TextStyle 4.5 "Archquik" nil)
  
  ;; Create dimblk
  (if (not (tblobjname "block" ""))
   (progn
    (setq OldDimBlk (getvar "dimblk"))
    (if (= OldDimBlk "")
     (setq OldDimBlk ".")
    )
    (setvar "dimblk" "")
    (setvar "dimblk" OldDimBlk)
   )
  )
  ;; Create dimstyle
  (entmake
   (list
    (cons 0 "DIMSTYLE"); Table
    (cons 100 "AcDbSymbolTableRecord"); Subclass marker
    (cons 100 "AcDbDimStyleTableRecord"); Subclass marker
    (cons 2 StyleName); Dimstyle name
    (cons 70 0); Standard flag
    (cons 3 "m"); DIMPOST
    (cons 4 ""); DIMAPOST
    (cons 5 ""); DIMBLK
    (cons 6 ""); DIMBLK1
    (cons 7 ""); DIMBLK2
    (cons 40 StyleScale); DIMSCALE
    (cons 41 0.3); DIMASZ
    (cons 42 0.2); DIMEXO
    (cons 43 0.38); DIMDLI
    (cons 44 0.25); DIMEXE
    (cons 45 0.0); DIMRND
    (cons 46 0.0); DIMDLE
    (cons 47 0.0); DIMTP
    (cons 48 0.0); DIMTM
    (cons 140 0.25); 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.09); DIMGAP
    (cons 71 0); DIMTOL
    (cons 72 0); DIMLIM
    (cons 73 1); DIMTIH
    (cons 74 1); 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 256); DIMCLRD
    (cons 177 256); DIMCLRE
    (cons 178 256); DIMCRRT
    (cons 270 4); DIMUNIT
    (cons 271 3); DIMDEC
    (cons 272 2); DIMTDEC
    (cons 273 2); DIMALTU
    (cons 274 2); DIMALTTD
    (cons 275 0); DIMAUNIT
    (cons 276 0); DIM?????
    (cons 277 2); DIMLUNIT
    (cons 279 0); DIM????
    (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
    ; DIMTXSTY
    (cons 340 (tblobjname "style" TextStyle))
    ; DIMLDRBLK
    (cons 342 (cdr (assoc 330 (entget(tblobjname "block" "")))))
    ; DIMLDRBLK1
    (cons 343 (cdr (assoc 330 (entget(tblobjname "block" "")))))
    ; DIMLDRBLK2 Block for the leader
    ;(cons 341 (cdr (assoc 330 (entget(tblobjname "block" "")))))
   )
  )
 )
 (progn
  (princ "\n Dimension Style not created")
  (exit)
 )
)
;; Set dimstyle current
(if Current
 (command "-dimstyle" "restore" StyleName)
)
;; Set echo
(setvar "CMDECHO" OldCmdEcho)
(princ)
)
(princ)

Link to comment
Share on other sites

Can anyone see what I've done wrong with the code above trying to get the block as closed arrows?

 

Thanks guys

Link to comment
Share on other sites

Can anyone see what I've done wrong with the code above trying to get the block as closed arrows?

 

Thanks guys

woodman78,

 

I am not exactly sure, But I do not think the Closed Filled arrow is a block like the rest of the arrows. I think its just drawn as a solid, So I am not sure how to deal with this at this point for entmake unless you create it as a custom block.

 

As I said, I not exactly sure. Maybe someone else has the answer.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...