Author Topic: Changing Dim styles  (Read 6480 times)

0 Members and 1 Guest are viewing this topic.

Hangman

  • Swamp Rat
  • Posts: 566
Changing Dim styles
« on: February 22, 2007, 09:04:20 PM »
Hey guys, can you help me once again ?.   Thanks.

So, I have an old dimension style 'Dim'.  I have several leaders and dimension strings on this style.
I have created a new dimension style "Dims_0.75" and I want to select all the leaders and dimension strings in the drawing and move them from the old style 'Dim' to the new style "Dims_0.75".

How can I go about accomplishing this task ??
I have started off with:
Code: [Select]
(setq Ldrs-Dims (ssget "X" '((0 . "LEADER,DIMENSION"))))

but then ran into a glitch with my limited knowledge of coding.

I pulled this info from a single leader:
Quote
Command: (setq a (entsel))

Select object: (<Entity name: 7efda078> (46.9048 37.1228 0.0))

Command: (setq b (car a))
<Entity name: 7efda078>

Command: (setq c (entget b))
((-1 . <Entity name: 7efda078>) (0 . "LEADER") (330 . <Entity name: 7efd2c10>)
(5 . "2D7") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "S-Notes") (100
. "AcDbLeader") (3 . "DIM") (71 . 1) (72 . 0) (73 . 3) (74 . 1) (75 . 0) (40 .
0.0) (41 . 0.0) (76 . 3) (10 44.6114 35.5323 0.0) (10 48.722 38.3966 0.0) (10
50.972 38.3966 0.0) (340 . <Entity name: 0>) (211 1.0 0.0 0.0) (210 0.0 0.0
1.0) (212 0.0 0.0 0.0) (213 0.0 0.0 0.0))

So first of all, I want to change the leader from the (3 . "DIM")   so it reads (3 . "Dims_0.75")
I know I can't use the CHPROP command, so I don't know what to use to make this change.  Perhaps the ENTMOD command ??

Secondly, If I am selecting a whole slew of leaders and dimensions, can this change be made to all of them at once or will I have to go through each one, one at a time ??

I need to change the Dimension style name in my details because when I xref them into a 36x48 sheet, they all take on the dimension style of the sheet because that is also 'Dim'.  So my leaders on a 1 1/2" detail are huge.  Of course the leaders on a 1/4" detail are so small you can't see the arrowhead on the paper.

Thanks again.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Guest

  • Guest
Re: Changing Dim styles
« Reply #1 on: February 22, 2007, 10:01:26 PM »
Personally, I would use QSELECT and skip the coding.

MickD

  • King Gator
  • Posts: 3637
  • (x-in)->[process]->(y-out) ... simples!
Re: Changing Dim styles
« Reply #2 on: February 22, 2007, 11:59:32 PM »
Does it have to be in code? if not you could set your new dim style current then use 'DIM' 'update' and select the dim's you want onto the new style (or type ALL) perhaps?.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Guest

  • Guest
Re: Changing Dim styles
« Reply #3 on: February 23, 2007, 08:06:42 AM »
Another question: Do you need to make the change to multiple drawings?

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Changing Dim styles
« Reply #4 on: February 23, 2007, 09:24:18 AM »
Window the entire drawing, lines text and all, and hit the dropdown for dimensions, and set it there.  It wont affect anything but the dimensions.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Hangman

  • Swamp Rat
  • Posts: 566
Re: Changing Dim styles
« Reply #5 on: February 23, 2007, 10:37:48 AM »
Does it have to be in code? ...
Another question: Do you need to make the change to multiple drawings?

Yes to both questions.
I have 400+ details.  I spent four days updating a dozen details and realized I'd be doing this for months.  I'm updating layers, text styles, dim styles, layout configurations, etc..
No, I can't do this manually, I've got to automate this process.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Guest

  • Guest
Re: Changing Dim styles
« Reply #6 on: February 23, 2007, 10:45:59 AM »
Does it have to be in code? ...
Another question: Do you need to make the change to multiple drawings?

Yes to both questions.
I have 400+ details.  I spent four days updating a dozen details and realized I'd be doing this for months.
Well, yeah it's gonna take you months if you only do THREE A DAY!!   :-D

I think I have something that might help you out but it's VBA.  It's a batch process-type program that will perform a set of commands on every drawing in every sub-folder of whatever folder you choose to run the program on.  Interested??!

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Changing Dim styles
« Reply #7 on: February 23, 2007, 11:17:51 AM »
All these not lisp personal posting in the lisp forumn.  What has the world of theswamp come to....??  :angel:

To answer your question, you would have to step through the selection set, and use 'entmod' with 'subst' on each dimension/leader object.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Changing Dim styles
« Reply #8 on: February 23, 2007, 11:44:15 AM »
Did I miss something?
Isn't it more complicated than that for Leader text?
If the text is supposed to be a different style and or size the updating of the leader won't change that, right?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Changing Dim styles
« Reply #9 on: February 23, 2007, 11:52:19 AM »
I don't think so.  I mean the text associated with the leader doesn't change if you use the change pallet, at least on my system with the single test I just did, it didn't.  You can get the text associated with the leader (dxf 340) but I don't see anything that tells the text which dim style it is associated to.
Quote from: Mtext associated to a leader
Command: (entget (value 340 ent))
((-1 . <Entity name: 7ed412f8>) (0 . "MTEXT") (5 . "2EF") (102 . "{ACAD_REACTORS")
(330 . <Entity name: 7ed412f0>) (102 . "}") (330 . <Entity name: 7ed13cf8>)
 (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbMText")
 (10 41.6702 13.4441 0.0) (40 . 0.18) (41 . 0.0) (71 . 1) (72 . 1)
(1 . "\\A1;this is a test") (7 . "Standard") (210 0.0 0.0 1.0) (11 1.0 0.0 0.0)
(42 . 2.22) (43 . 0.18) (50 . 0.0) (73 . 1) (44 . 1.0))
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Hangman

  • Swamp Rat
  • Posts: 566
Re: Changing Dim styles
« Reply #10 on: February 23, 2007, 12:03:42 PM »
Does it have to be in code? ...
Another question: Do you need to make the change to multiple drawings?

Yes to both questions.
I have 400+ details.  I spent four days updating a dozen details and realized I'd be doing this for months.
Well, yeah it's gonna take you months if you only do THREE A DAY!!   :-D

I think I have something that might help you out but it's VBA.  It's a batch process-type program that will perform a set of commands on every drawing in every sub-folder of whatever folder you choose to run the program on.  Interested??!

Well, ... Yeah.   :roll:  Three or four, depending on the time.  Updating these stupid typicals doesn't make any money.  So I can only update them in my spare time, in between money making projects.  So on the one hand, I can only work on them when I don't have a project on my desk.  On the other hand, the engineers are yelling at me cause they are taking too much time deciphering old details and redlining them.  They are spending more time than it takes to update the stupid things but ... please don't get me started in the politics, I'm not a very good politician.  If I had my way ...  :pissed:

Anywho, I would be interested in your batch process program if I knew VBA and could edit the code.  This lisp piece I am writing, I will eventually use in a couple other ideas I have in the brewery.  Thank you for offer though.

...
To answer your question, you would have to step through the selection set, and use 'entmod' with 'subst' on each dimension/leader object.
I was afraid you'd say that.
Ok, so I need to find an example of stepping through a selection set ...  shouldn't be a problem.
Could you give me an example of how the 'entmod' & 'subst' would be coded together ??  I have one from the help files refering to a layer change.  Would this be similar:  (the ?? refers to my uncertainty of the entry)
Code: [Select]
(setq leader (subst (cons 3 "Dims_0.75" ??) (assoc 70 ?? leader) leader))

Did I miss something?
Isn't it more complicated than that for Leader text?
If the text is supposed to be a different style and or size the updating of the leader won't change that, right?

The good news here is that we don't associate our leaders with the text.  Nobody here likes that so our leaders are seperate from any text.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Changing Dim styles
« Reply #11 on: February 23, 2007, 12:12:43 PM »
To step through a selection set, use something like
Code: [Select]
(setq cnt -1)
(while (setq Ent (ssname ss (setq cnt (1+ cnt))))
....
)
Then to change the entities code (you almost had it right) you would do
Code: [Select]
(setq EntData (entget Ent))
(entmod (subst (cons 3 "Dims_0.75) (assoc 3 EntData) EntData))

If you want an explanation I can give one, just short on time right now.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Guest

  • Guest
Re: Changing Dim styles
« Reply #12 on: February 23, 2007, 12:22:34 PM »
Here's part of the program that I threw together (in VBA of course  :wink:)

This will change all leaders and DIM*s to the style Standard; just change it to what ever your dimension style name is.

Code: [Select]
Private Sub ProcessDrawing()
    Dim objEnt As AcadEntity
    Dim ssSet As AcadSelectionSet
    Dim FilterType(1) As Integer
    Dim FilterData(1) As Variant

    FilterType(0) = 0
    FilterData(0) = "LEADER,DIM*"
    FilterType(1) = 8
    FilterData(1) = "*"

    Set ssSet = vbdPowerSet("DimChange")
    ssSet.Select acSelectionSetAll, , , FilterType, FilterData
    For Each objEnt In ssSet
        objEnt.StyleName = "Standard"
    Next objEnt
End Sub


And down here is the WHOLE program.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Changing Dim styles
« Reply #13 on: February 23, 2007, 12:41:09 PM »
Alternate solution, that may or may not be done with LISP or a script.

Command: -dimstyle

Current dimension style:  Standard
Current dimension overrides:
 DIMSCALE    40.0000
Enter a dimension style option
[Save/Restore/STatus/Variables/Apply/?] <Restore>: s

Enter name for new dimension style or [?]: Standard

That name is already in use, redefine it? <N>:y

Go into the Detail drawings and just change the CHILD dimension style names, such that when inserted or referenced into the PARENT drawing the Style names are not equal and therefore do not produce the undesired results as described by the user.
Be your Best


Michael Farrell
http://primeservicesglobal.com/

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Changing Dim styles
« Reply #14 on: February 23, 2007, 01:14:52 PM »
I don't think so.  I mean the text associated with the leader doesn't change if you use the change pallet, at least on my system with the single test I just did, it didn't. 

I just assumed you would want it to change. Never mind. :?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.