Author Topic: Challenge: Dim Reactor  (Read 8477 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Challenge: Dim Reactor
« Reply #15 on: August 21, 2008, 07:43:08 PM »
5. almost forgot.... so where are the swamp lispers ?

I was looking at one way while trying to get my work done, need to keep my job and all.  I haven't figured it out yet, but I think it will work sweet when I get it there.  Hopefully tomorrow.
Tim

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

Please think about donating if this post helped you.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Challenge: Dim Reactor
« Reply #16 on: August 21, 2008, 07:49:04 PM »

5. almost forgot.... so where are the swamp lispers ?

Some of us have real work that needs doing ...

and other languages to study  :-)
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.

Spike Wilbury

  • Guest
Re: Challenge: Dim Reactor
« Reply #17 on: August 21, 2008, 07:52:40 PM »
I only asked where there were.....  :-P

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Challenge: Dim Reactor
« Reply #18 on: August 21, 2008, 08:30:31 PM »
Luis,
I decided to make a major revision in the commandended routine.

See if you can break it.

<edit: renamed lisp file>
« Last Edit: August 22, 2008, 11:58:33 AM by CAB »
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.

Spike Wilbury

  • Guest
Re: Challenge: Dim Reactor
« Reply #19 on: August 21, 2008, 10:25:37 PM »
Luis,
I decided to make a major revision in the commandended routine.

See if you can break it.


That's the right way..... Cheers!

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Challenge: Dim Reactor
« Reply #20 on: August 22, 2008, 07:10:43 AM »
so where are the swamp lispers ?

Working.......  :|
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

Chuck Gabriel

  • Guest
Re: Challenge: Dim Reactor
« Reply #21 on: August 22, 2008, 07:12:39 AM »
Some of us have real work that needs doing ...

Get your priorities straight Kerry. :-P

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Challenge: Dim Reactor
« Reply #22 on: August 22, 2008, 06:03:48 PM »
Here is one that seems to be working.  It has two variables that you can control which dims get edited.  There is the 'MinLength' and the 'IgnoreDimStyleList'.  Let me know.  I know if can be cleaned up a bit, but for now it works.   :-D

Code: [Select]
(or
    GlbVarReactObjectAdded
    (setq GlbVarReactObjectAdded (vlr-acdb-reactor "DimObjectReactor" '((:vlr-objectAppended . ObjectAppenedReact))))
)
(defun ObjectAppenedReact (react objList / CorrectionList EntData tempList tempSubList tempList2)
   
    (setq CorrectionList
        (list
            -3
            (list
                "ACAD"
                '(1000 . "DSTYLE")
                '(1002 . "{")
                '(1070 . 3)
                '(1000 . "\"")
                '(1070 . 277)
                '(1070 . 2)
                '(1002 . "}")
            )
        )
    )
    (foreach i objList
        (if
            (and
                (equal (type i) 'ENAME)
                (= (cdr (assoc 0 (setq EntData (entget i '("*"))))) "DIMENSION")
                (not (member (cdr (assoc 3 EntData)) IgnoreDimStyleList))
            )
            (progn
                (if (< (cdr (assoc 42 EntData)) MinLength)
                    (if (setq tempList (assoc -3 EntData))
                        (if (setq tempSubList (assoc (caadr CorrectionList) (cdr tempList)))
                            (if (not (equal (cadr CorrectionList) tempSubList))
                                (entmod
                                    (subst
                                        (subst (cadr CorrectionList) tempSubList tempList)
                                        tempList
                                        EntData
                                    )
                                )
                            )
                            (entmod (subst (cons -3 (append (cadr tempList) (cadr CorrectionList))) tempList EntData))
                        )
                        (entmod (append EntData (list CorrectionList)))
                    )
                    (if (setq tempList (assoc -3 EntData))
                        (progn
                            (foreach i (cdr tempList)
                                (if (equal (cadr CorrectionList) i)
                                    (setq tempList2 (cons (list (car i)) tempList2))
                                    (setq tempList2 (cons i tempList2))
                                )
                            )
                            (entmod (subst (cons -3 (reverse tempList2)) tempList EntData))
                        )
                    )
                )
                (if react
                    (vlr-pers
                        (vlr-object-reactor
                            (list (vlax-ename->vla-object i))
                            "DimObjectReactor"
                            '(
                                (:vlr-objectClosed . ObjectModifiedDone)
                                (:vlr-erased . ObjectEraseReactor)
                            )
                        )
                    )
                )
            )
        )
    )
    (and
        GlbVarDimReactCommandEnded
        (vlr-remove GlbVarDimReactCommandEnded)
    )
    (setq GlbVarDimReactCommandEnded nil)
    (setq GlbVarDimReactEntList nil)
    (princ)
)
(defun ObjectModifiedDone (ownObj react tempList)
   
    (setq GlbVarDimReactEntList (cons (vlax-vla-object->ename ownObj) GlbVarDimReactEntList))
    (or
        GlbVarDimReactCommandEnded
        (setq GlbVarDimReactCommandEnded (vlr-command-reactor "tempDimReactCommandEnded" '((:vlr-commandEnded . DimReactCommandEnded))))
    )
    (princ)
)
(defun DimReactCommandEnded (react cmdNames)
   
    (foreach i GlbVarDimReactEntList
        (ObjectAppenedReact nil (list i))
    )
    (princ)
)
(defun ObjectEraseReactor (Obj React NotSure)
   
    (vlr-pers-release React)
    (vlr-remove React)
)
Tim

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

Please think about donating if this post helped you.

whdjr

  • Guest
Re: Challenge: Dim Reactor
« Reply #23 on: September 24, 2008, 08:04:47 AM »
so where are the swamp lispers ?
Some of us have no clue about reactors.  :-(

Alan Cullen

  • Guest
Re: Challenge: Dim Reactor
« Reply #24 on: September 24, 2008, 08:44:01 AM »
Hey...I'm a Swamp Lisper....

What is a reactor?

Sorry...I was asleep that day.

Spike Wilbury

  • Guest
Re: Challenge: Dim Reactor
« Reply #25 on: September 24, 2008, 09:34:13 AM »
so where are the swamp lispers ?
Some of us have no clue about reactors.  :-(

:)

no problema, it was just a 'tag' to get more attention to this thread/topic.

i had a lot of clues, but most of them are now lost... there are many samples posted here 'about reactors'

Spike Wilbury

  • Guest
Re: Challenge: Dim Reactor
« Reply #26 on: September 24, 2008, 09:49:21 AM »
What is a reactor?

many autocad commands are made with reactors, like leaders, dimensions, etc. to mention a few... with the intro of vital lisp (later renamed to visual lisp) reactors were available for autolisp to make more intelligent alike routines... in example the ability to place automatic dimensions on one or multiple entities, right after a modification or when an specific command ended, or right before closing a drawing to be able to make last corrections before closing it,  etc. etc etc.

now, there are the 'fields' objects, so many things can be used with these objects...

hth.