Quantcast
Channel: Autodesk India Community aggregator
Viewing all articles
Browse latest Browse all 1680

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Setting dimstyle programatically causes ribbon control to blank

$
0
0

I'm writing a program that creates dimension styles programatically from data stored in a text file.  The first time that I run the program it works fine.  It creates a number of dimension styles and sets one of them current and the current style is reflected correctly in the ribbon:

blank dimstyle0.PNG

 

The second time I run the program the styles that already exist are redefined and one of them is set to the current style. This time the current style is NOT reflected correctly in the ribbon -- the current style appears blank.

blank dimstyle3.PNG

 

Here is some simplified code that reproduces the problem.  The first time that it is run it creates a dimstyle "test style" and sets it current.  The style is correctly show in the ribbon control.  The second time it is run the ribbon control goes blank.

(defun c:dimerr ( / styname famlist suffix)

    (setq styname "test style")
    (setq famList '(
        ("[PARENT]" . "")
        ("[LINEAR FAMILY]" . "$0")
        ("[ANGULAR FAMILY]" . "$2")
        ("[DIAMETER FAMILY]" . "$3")
        ("[RADIUS FAMILY]" . "$4")
        ("[ORDINATE FAMILY]" . "$6")
        ("[LEADER FAMILY]" . "$7")
    ))

    (foreach famMember famList
      (princ (strcat "\n" (car FamMember)))
			
      ;This is where I make some changes to each child style
      ;based on some data...but that seems to have no effect
      ;so I left it out.
			
      (if (setq suffix  (cdr famMember))(progn
         (setq famname (strcat styname suffix))
         (princ (strcat "\nSaving style: " famname ))
         (if (tblsearch "dimstyle" famname)
            (command "dimstyle" "save" famname "y")
            (command "dimstyle" "save" famname)
         )
      ))
    )
    (command "-dimstyle" "restore" styname)
)

Any help would be appreciated.

 

Thanks,

 

James LeVieux


Viewing all articles
Browse latest Browse all 1680

Latest Images

Trending Articles



Latest Images