Jump to content

Recommended Posts

Posted

Hi there! As suggested by "true-lispers" I'm starting to use entmake to create stuff instead of commands, and I have a question for hardcore entmakers.

 

 

I'm using autocad 2014, so based on Autodesks 2014 dxf codes reference (http://images.autodesk.com/adsk/files/autocad_2014_pdf_dxf_reference_enu.pdf, pages 46 to 50 for Dimstyle group codes) I'm making a lisp to create dimstyles to our standards using entmake. To start with, I took our Template, went into the Dim Style Manager, selected our dimstyle then clicked the "compare" button. I now have all the properties, variables and values that make our standard dimstyle. Up to now, everything is fine!

 

 

Using the previous link, I get the corresponding DXF code of the variables to create the complete list to feed the entmake, but on the 76 variables populating the "Compare Dimension Styles" dialog, there are 19 I could not find the corresponding DXF group code looking into Autodesks own reference. These are:

 

 

DESCRIPTION             VARIABLE        VALUE
Alt zero factor         DIMALTMZF       100
Alt zero suffix         DIMALTMZS       
Angle zero supression   DIMAZIN         0
Arc len symbol          DIMARCSYM       0
Decimal separator       DIMDSEP         .
Dim line linetype       DIMLTYPE        BYBLOCK
Dim text direction      DIMTXTDIRECTION Off
Ext line 1 linetype     DIMLTEX1        BYBLOCK
Ext line 2 linetype     DIMLTEX2        BYBLOCK
Fit: arrow and text     DIMATFIT        3
Fixed ext line enabled  DIMFXLON        Off
Fixed ext line length   DIMFXL          1
Large rad dim jog angle DIMJOGANG       45
Text background color   DIMTFILLCLR     BYBLOCK
Text background enabled DIMTFILL        0
Text color              DIMCLRT         BYLAYER
Zero factor             DIMMZF          100
Zero suffix             DIMMZS          
Zero suppression        DIMZIN          3

Is there DXF group codes for these variables? What should I do with them? Suggestions? =)

 

 

Thanks. Regards,

Jef!

Posted

Snownut,

 

 

Thats not exactly what i'm looking for. The link provided is for entities dimensions, and I'm looking for dim styles dxf codes. Digging down I found a dxf dimension table section

http://exchange.autodesk.com/autocad/enu/online-help/browse#WS1a9193826455f5ff18cb41610ec0a2e719-7a53.htm

Beside dxf code 289 (dimatfit) that was not in the PDF I provided the link to, the 2 documents content are identical and both do not contain any of the 19 I'm looking for.

 

 

Any help/advice is still welcome!

Cheers,

Jef!

Posted

Thanks for giving me in post #4 the exact same link that I gave in my post #3... ;)

 

 

If you use VLIDE to inspect a Dimension Entity, the following is what typically appears..

... Am I not getting what your trying to tell me, or do you not understand what I'm asking...

Why would I do that? I am not talking of "AcDbDimensions". I am talking about "AcDbDimStyleTableRecord". Maybe I am missing something.

 

 

Both autodesk reference that I have do not contain any of the 19 I'm looking for. (listed in post #1)

Posted (edited)

Jef!,

 

I quickly see at least three of the DXF codes you listed, on the list of DIMSTYLE DXF Codes on the last link I posted. (there may be more) Not sure what to say about the unlisted ones..

 

Apparently there are also undocumented 341, 342, 343 & 344 codes (no idea just what they control).

 

Sometimes you need to do a little investigation, try changing a couple of the group codes in question VIA, setvar as they are listed and not read only variables, then do a regen. Finally in VLIDE in the view menu item, browse drawing database, browse tables select the dimension styles and see just what changed.

Edited by Snownut
Posted

Here is a routine by Tim Spangler at TheSwamp: Creating a dimstyle

 

;;; ------------------------------------------------------------------------
;;;    CREATE_DIMSTYLE.LSP
;;;
;;;    Copyright © October, 2007
;;;    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.
;;;
;;;    CREATE_DIMSTYLE
;;;
;;;		 Description:
;;;			Called from a menu pulldown or rightclick menu
;;;				*(CREATE_DIMSTYLE "test0" 48.0 "Archquik")
;;;
;;; ------------------------------------------------------------------------
;;;		VERSION HISTORY
;;;
;;; ------------------------------------------------------------------------

;;; MAIN FUNCTION ;;;;;;;;;;;;;;;;;;;;;;;;;
(defun DIMSTYLE_CREATE (StyleName StyleScale TextStyle / OldDimBlk OldCmdEcho)

;; Set echo
(setq OldCmdEcho (getvar "CMDECHO"))
(setvar "CMDECHO" 0)

;; Create textstyle
(if (not (tblsearch "STYLE" TextStyle))
	(TEXTSTYLE_CREATE)
)
;; Create dimblk
(if (not (tblobjname "block" "_Oblique"))
	(progn
		(setq OldDimBlk (getvar "dimblk"))
		(if (= OldDimBlk "")
			(setq OldDimBlk ".")
		)
		(setvar "dimblk" "_Oblique")
		(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 ""); DIMPOST
		(cons 4 ""); DIMAPOST
		(cons 5 "_Oblique"); DIMBLK
		(cons 6 "_Oblique"); DIMBLK1
		(cons 7 ""); DIMBLK2
		(cons 40 StyleScale); 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 1); 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 0); DIMCLRD
		(cons 177 0); 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); DIM?????
		(cons 277 4); DIMLUNIT
		(cons 279 2); 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" "_Oblique")))))
		; DIMLDRBLK1
		(cons 343 (cdr	(assoc 330 (entget(tblobjname "block" "_Oblique")))))
		; DIMLDRBLK2 Block for the leader
		;(cons 341 (cdr	(assoc 330 (entget(tblobjname "block" "")))))
	)
)
;; Set dimstyle current
(command "-dimstyle" "restore" StyleName)
;; Set echo
(setvar "CMDECHO" OldCmdEcho)
(princ (strcat "\n\n--\"" StyleName "\" is now the current Dimstyle--"))
(princ)
)
;; ENTMAKE TEXT STYLE
(defun TEXTSTYLE_CREATE (/)

(entmake 
	(list
		(cons 0 "STYLE") 
	  (cons 100 "AcDbSymbolTableRecord") 
	  (cons 100 "AcDbTextStyleTableRecord") 
	  (cons 2 "Archquik");; Style Name
	  (cons 70 0)
	  (cons 40 0.0);; Fixed text height
	  (cons 41 1.0);; Width Factor
	  (cons 50 0.0);; Oblique angle
	  (cons 71 0)
	  (cons 42 2.0);; Last height used
	  (cons 3 "archquik.shx");; Primary font name 
	  (cons 4 "");;  Big font name
	)
)
(princ)
)
(princ)

Posted

Snowdut,

 

 

I started with an old dxf list found on the web and appended the new codes as I found them, made an excel spreadsheet to look for vars and return me corresponding dxf codes. I was only comparing adesks dxf # with mine (could not find any "new codes") but searching the var names instead I just realized I had 4 typos the original list. I'm now down to 14 unknowns. (for reference these are)

 

 

DESCRIPTION             VARIABLE        VALUE
Alt zero factor         DIMALTMZF       100
Alt zero suffix         DIMALTMZS       
Arc len symbol          DIMARCSYM       0
Dim line linetype       DIMLTYPE        BYBLOCK
Dim text direction      DIMTXTDIRECTION Off
Ext line 1 linetype     DIMLTEX1        BYBLOCK
Ext line 2 linetype     DIMLTEX2        BYBLOCK
Fixed ext line enabled  DIMFXLON        Off
Fixed ext line length   DIMFXL          1
Large rad dim jog angle DIMJOGANG       45
Text background color   DIMTFILLCLR     BYBLOCK
Text background enabled DIMTFILL        0
Zero factor             DIMMZF          100
Zero suffix             DIMMZS          

Sometimes you need to do a little investigation, try changing a couple of the group codes in question VIA, setvar as they are listed and not read only variables, then do a regen. Finally in VLIDE in the view menu item, browse drawing database, browse tables select the dimension styles and see just what changed.
Until few weeks ago I was using notepad to write code, now fully converted to VLIDE. Even thought I read many tutorials and help files about VLIDE I'm still not acquainted with all its built in tools. Now that I know where to investigate, I will (try)! =D

That quote was priceless! You just gave me a fishing rod!

Thank you so much!

 

 

@ymg3 Nice routine! It looks better than mine.. I'm still at the making the list step =)

 

 

Creating a dimstyle via lisp is a thing, but reproducing my dimstyle via lisp quite a nice challenge. The 1rst thing I'm trying to achieve is to set up the whole dxf list of the dimstyle where I work, to be able to create it back if it get purged in the first place, or if the starting drawing is not our template...

 

 

I'm afraid of using a few years old routine (especially routines that use entmake) because I have no clue what could happen if a lisp created a dimstyle with dxf codes tagged by autodesk as obsolete. Maybe you know?

Posted

As said that routine is by Tim Spangler.

 

I don't think an obsolete DXF Codes would be a big problem.

 

At worse Autolisp will throw an error ant not create the entity.

At this point check the last error in VLIDE.

 

Not sure, but I believe some of the Var may have gone from being 0

to now being "OFF" or "ON"

 

Just test it with whatever Version you are using and see what it does

before launching it into full production.

 

ymg

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...