Jump to content

Changing Dimensions preserving their Dimstyle name


Recommended Posts

Posted

Coming from here

 

http://discussion.autodesk.com/forums/thread.jspa?threadID=764691

 

I just wanted to post this in case someone know if this is possible...

 

I tested the attached routine to change dimensions according to current dimstyle settings, but preserving their "Dimscale" (or Dimension size) but I was thinking it would be great if it was possible to preserve also their Dimstyle name, updating the rest of the current dimstyle settings to a bunch of selected dimensions...

 

Anybody has an idea about it?

dimup.lsp

Posted
Coming from here

 

http://discussion.autodesk.com/forums/thread.jspa?threadID=764691

 

I just wanted to post this in case someone know if this is possible...

 

I tested the attached routine to change dimensions according to current dimstyle settings, but preserving their "Dimscale" (or Dimension size) but I was thinking it would be great if it was possible to preserve also their Dimstyle name, updating the rest of the current dimstyle settings to a bunch of selected dimensions...

 

Anybody has an idea about it?

 

Of course it is possible: :wink:

 

You can use this:

(setq t1 (entget (entsel "select")))

 

to get the entity list of a selected dim, then you can use this:

(setq t1 (subst (cons 8 "1") (assoc 8 t1) t1 ))

to modify any part of the dims entity list (this will change the layer)

 

then use this:

(entmod t1)

to modify the entity.

 

Here is a list of the DXF codes and what they mean:

 

*This list is for dimstyles not dimension entities*

(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" "")))))

 

This should get you started.

Posted

Great... i know I did something here....

 

;;Routine to change all dimensions to the current dimstyle preserving 
their dimscale and dimstyle name

(defun c:dimes2 ()
(setq ss1 (ssget "X" (list (cons 0 "dimension"))))
(setq SSLEN (sslength SS1))
(setq sscnt 0 sspr (1+ sscnt))
(repeat sslen
(prompt (strcat "\nProcessing " (itoa SSPR) " of " (itoa SSLEN) " dimensions."))
(setq EN (ssname SS1 SSCNT))
;set dimscale
(command "dimscale" (vla-get-ScaleFactor (vlax-ename->vla-object EN)))

(COMMAND "DIM1" "UPDATE" EN "")
(setq sscnt (1+ sscnt) SSPR (1+ sscnt))
);r
(princ)
);d

;;Another code

(PRINC
   "\nSelect Dimensions and text to apply the background fill and update...: "
 )
 (AND (SETQ ss (SSGET "_:L" '((0 . "*DIMENSION*"))))
      (FOREACH x (VL-REMOVE-IF 'LISTP (MAPCAR 'CADR (SSNAMEX ss)))
 (COND
   ((EQ "DIMENSION" (CDR (ASSOC 0 (SETQ elist (ENTGET x)))))
    (SETQ elist (SUBST (CONS 340 (tblobjname "style" TextStyle)) (ASSOC 340 elist) elist)
    ) ;_ setq
    (ENTMOD elist)

   (T T)
 ) ;_ cond
      ) ;_ foreach
 ) ;_ and

 

This code (typing dimes2) got a 'malformed list on input' error, but renamed all dimensions in current drawing to current dimstyle name preserving their own variables.... What I need is exactly the opposite... preserve Dimscale and dimstyle name but updating all variables...

 

and actually the only variable I am trying to update is Dimtfill....

 

Anybody who is willing to help a bit?

--------------------------------

It seems I got my head upside down...

Posted

I tought it could work adding something like this... but obviously doesn´t work....

 

;;Routine to change all dimensions to the current dimstyle preserving the dimscale and dimstyle name for each dimension
;;;make sure to set the dimstyle you require as current before running this routine
(defun c:dimes3 ()
(setq ss1 (ssget "X" (list (cons 0 "dimension"))))
(setq SSLEN (sslength SS1))
(setq sscnt 0 sspr (1+ sscnt))
(repeat sslen
(prompt (strcat "\nProcessing " (itoa SSPR) " of " (itoa SSLEN) " dimensions."))
(setq EN (ssname SS1 SSCNT))
;set dimscale
(command "dimscale" (vla-get-ScaleFactor (vlax-ename->vla-object EN)))
[color=red](command "dimstyle" (cdr (assoc 40 (tblsearch "DIMSTYLE" (dxf 3 EN)))))[/color]
(COMMAND "DIM1" "UPDATE" EN "")
(setq sscnt (1+ sscnt) SSPR (1+ sscnt))
);r
(princ)
);d

Posted

This is part of a routine that seems to set the dimstyle (restored from a specific object).... but I don´t know how to insert this into my code...

 

     (command ".DIMSTYLE" "R" (cdr (assoc 3 EntList@)))
     (setq DimStyle@ (tblsearch "STYLE" (getvar "DIMTXSTY")))

Posted
Of course it is possible: :wink:

 

You can use this:

(setq t1 (entget (entsel "select")))

 

to get the entity list of a selected dim, then you can use this:

(setq t1 (subst (cons 8 "1") (assoc 8 t1) t1 ))

to modify any part of the dims entity list (this will change the layer)

 

then use this:

(entmod t1)

to modify the entity.

 

Here is a list of the DXF codes and what they mean:

 

*This list is for dimstyles not dimension entities*

(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" "")))))

 

This should get you started.

 

Hey Tim.... do you know what "(cons" code I can use for Dimtfill?

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