Author Topic: Changing dimension style by picking  (Read 2461 times)

0 Members and 1 Guest are viewing this topic.

cadriver

  • Guest
Changing dimension style by picking
« on: January 05, 2005, 01:33:56 PM »
Here is a routine that allows the cad user to change to a different dimension style by picking the one he or she desires. The only problem there is a hiccup that I cannot stop. The first is the error message....

Command: dms

Select Dimension To Set That Style Current: DIM
Dim: Restore
Enter a dimension style name, [?] or <select dimension>: MeinArw
Current dimension style:  MeinArw

Dim: RESTORE
Enter a dimension style name, [?] or <select dimension>: ; error: bad argument
value: AutoCAD command: #<SUBR @046473c0
QUIT>


The routine is as follows.........


(DEFUN C:DMS()
(setq nt T)
   (while nt
    (if (Setq ename (car (Entsel "\nSelect Dimension To Set That Style Current: ")))
     (if (or (= (cdr (assoc 0 (entget ename))) "DIMENSION")
         (= (cdr (assoc 0 (entget ename))) "LEADER"))
      (setq nt nil)
       (princ "\n**** Not A Dimension or A Leader Try Again.***: ")
     );end if
    );end if
   );end while
   (setq elist (entget ename))
   (setq D (cdr (Assoc 3 elist)))
    (If (/= ename nil) (Command "DIM" "Restore" D ""))
     (command exit)
      (prompt "\nThe Current Dimstyle is Now; ")(prompt D)
   (princ)
);end defun



I am using 2004.......any assistance would be greatly appreciated.


Thanks

Crank

  • Water Moccasin
  • Posts: 1503
Changing dimension style by picking
« Reply #1 on: January 05, 2005, 01:38:14 PM »
Isn't it easier to use a macro?
Code: [Select]

ID__DIMR    [_Button("DimRestore","DimRestore.bmp","DimRestore.bmp")]^C^CDIM1 restore;;
Vault Professional 2023     +     AEC Collection

Anonymous

  • Guest
Changing dimension style by picking
« Reply #2 on: January 05, 2005, 01:57:29 PM »
A macro is good.....I have plenty in toolbars right now.....just like the ability to keyboard in the command. I would use a single letter command....I guess just a preference.......thanks for the response.

whdjr

  • Guest
Changing dimension style by picking
« Reply #3 on: January 05, 2005, 02:14:44 PM »
If you remove the line

 (command exit)

It should work fine.
You don't need it.

Anonymous

  • Guest
Changing dimension style by picking
« Reply #4 on: January 05, 2005, 02:41:53 PM »
It continues to ask me to select a dimension........

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Changing dimension style by picking
« Reply #5 on: January 05, 2005, 03:01:28 PM »
Code: [Select]

(defun c:dms (/ get-type get-style ent)

   (defun get-type (ent)
(cdr (assoc 0 (entget ent)))
)

   (defun get-style (ent)
(cdr (assoc 3 (entget ent)))
)

   (cond
((setq ent (car (entsel "\nSelect Dim: ")))

 (cond
((= (get-type ent) "DIMENSION")
(vl-cmdf "dimstyle" "restore" (get-style ent))
)
((= (get-type ent) "LEADER")
(vl-cmdf "dimstyle" "restore" (get-style ent))
)
)
 )
(T (princ))
)

   )
TheSwamp.org  (serving the CAD community since 2003)

Anonymous

  • Guest
Changing dimension style by picking
« Reply #6 on: January 05, 2005, 03:03:32 PM »
THANK YOU SO MUCH.......YOU ARE A GENTLEMAN AND A SCHOLAR

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Changing dimension style by picking
« Reply #7 on: January 05, 2005, 05:05:50 PM »
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.