Author Topic: Changing Dimstyles with Lisp  (Read 2865 times)

0 Members and 1 Guest are viewing this topic.

whdjr

  • Guest
Changing Dimstyles with Lisp
« on: May 18, 2007, 10:53:07 AM »
I need to change some colors in some dimensions in a template dwg.  The code below sets everything correctly it just doesn't apply it to the dwg.  Can someone help please?

Code: [Select]
(defun test (/ dim)
 (defun sub (lst code int)
  (setq dim (subst (cons code int) (assoc code lst) lst))
 )
 (while
  (if (not dim)
   (setq dim (tblnext "DIMSTYLE" T))
   (setq dim (tblnext "DIMSTYLE"))
  )
  (if dim
   (mapcar '(lambda (x y)
     (sub dim x y)
    )
   '(176 177 178)
   '(1 1 4)
   )
  )
  (entmod dim)
 )
)

Guest

  • Guest
Re: Changing Dimstyles with Lisp
« Reply #1 on: May 18, 2007, 10:59:48 AM »
Not having worked with changing dimstyles via LSP, I'm just thinking out loud here but, do you need to ENTUPD the dim??

whdjr

  • Guest
Re: Changing Dimstyles with Lisp
« Reply #2 on: May 18, 2007, 11:07:59 AM »
Entupd updates an ename.  'TBLNEXT' doesn't give an ename and I think that is the issue.  I used entmod because it is supposed to work on an entity list but technically I don't have a complete entity list from TBLNEXT.

whdjr

  • Guest
Re: Changing Dimstyles with Lisp
« Reply #3 on: May 18, 2007, 11:13:34 AM »
I tried changing (entmod dim) to
(entupd (tblobjname "DIMSTYLE" (cdr (assoc 2 dim) )))
but it didn't help any.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: Changing Dimstyles with Lisp
« Reply #4 on: May 18, 2007, 11:47:30 AM »
Dimension "entities" are special blocks, that when created, use properties stored in a dimstyle - which is a table object.  If you change the dimstyle pragmatically, chances are you'd need to iterate through the database and entupd each dimension "entity" referencing that style?
James Buzbee
Windows 8

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Changing Dimstyles with Lisp
« Reply #5 on: May 18, 2007, 06:37:58 PM »
You've changed the definition Table, you now need to change the individual dims, so ..

Command: dim

Dim: update

Select objects: ....................
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

whdjr

  • Guest
Re: Changing Dimstyles with Lisp
« Reply #6 on: May 21, 2007, 03:34:31 PM »
You've changed the definition Table, you now need to change the individual dims, so ..

Command: dim

Dim: update

Select objects: ....................

This was a template dwg that didn't have any actual dimensions just the styles, and it never actually changed the styles.

I did it all manually this morning.

Thanks,