Author Topic: Grread OverHead to enable "shapes"  (Read 2879 times)

0 Members and 1 Guest are viewing this topic.

reltro

  • Guest
Grread OverHead to enable "shapes"
« on: August 30, 2014, 03:21:13 AM »
Hey people...

I want to share an overhead I wrote for (grread ...) to imitate some kind of Dialog.

It was/is a try to pack "all" returns of the grread-function into a form where the position of the mouse, over a shape defines wich direction is taken.

A shape and his action its defined by the following functions:
    Note:   
                * all of them are lambda-expr or a symbol to a function
                * all of them are optional, expect "mouseover"
            * All of the functions are running in her own namespace, no symbol is hidden, expect "SUPER"  (this was the main goal)
                * "SUPER" and "this" are something special (see below)
                * the text between "[ ... ]" are the given arguments
            

 - mouseover [this MousePoint]
 - entering [this MousePoint]
 - leaving [this MousePoint]
 - mouseMove [this MousePoint]
 - leftclick [this MousePoint]
 - rightclick [this code]
 - keypressed [this code]
 - zommed [this MousePoint Scale]
 
**** ALL the coordinates given as "MousePoint" are plan to the DCS, relativ to the current (getvar 'viewcenter) and scaled up/down to the domain 0 to 100, where (0 100) [x,y] matches the upper-mid of the Display and (0 -100) the lower-mid. (except __blockref__ is set - see below) ***

The shapes are nested in a form like this:
Code: [Select]
(
    (__MainLoop__ (Shape01 Shape02)   ;;;MainLoop is also something special ;)
    (mouseover (lambda (this Pt / ) 'T))
)
    (Shape01 nil ;no SubShape
        (mouseover (lambda (this Pt / ) ........ ))
    ...
    )
   (Shape02 (SubShape)
      ...
   )
   (SubShape nil
     ...
   )
   (otherData "WhatsUp"
       (nothing "oh yeah")
       (aLot "oh yeah")
   )
)

It seems that the text I wrote is too long ;) The full-Text can be found in the attachment

Attached is the function Mor:DisplayEngine - (load "Mor_DisplayEngine.vlx") and 2 Examples

The first example needs 2 files:
 - MOr_Menu.lsp (is a parser)
 - Example_01.lsp
 
After loading them execute (C:E_01).

To show the possiblities of __blockRef__ u are going to be asked to select a BlockReference.
If u select one, also try to select a non-uniform-scaled and/or rotated BlockRef ;)
Change also the UCS, (3D)View.

If no BlockRef is selected, the whole stuff is displayed realtiv Screen and the ViewCenter.

The second example is a stupid one, just to show how (super '__trans__) works.
** example_02 returns a lambda-expr (other than above) use it like:

(setq whatEver (load "example_02.lsp"))
(whatEver)


So far so good...
Tell me what u think! any feedback is good feedback.

greets reltro
« Last Edit: August 30, 2014, 03:54:36 AM by reltro »

reltro

  • Guest
Re: Grread OverHead to enable "shapes"
« Reply #1 on: August 30, 2014, 04:46:08 AM »
THE PLAN:
In the fwollowing I want to develop some parser wich should it make easier to stick together a dialog with checkboxes, buttons, and so on...


If someone wanna join, it would be nice :)

greets reltro

reltro

  • Guest
Re: Grread OverHead to enable "shapes"
« Reply #2 on: August 30, 2014, 06:53:53 AM »
Example 03 (a stupid one) :P

open the attached drawing. A dynamic block is inside....

Load MOr_displayengine.vlx
Load Example_03.lsp

run (C:E3)
select the BlockRef
hover around with the mouse...

reltro

reltro

  • Guest
Re: Grread OverHead to enable "shapes"
« Reply #3 on: August 31, 2014, 04:11:57 PM »
Here somethin usefull using MOr:Displayengine and the above shown MOr:menu...

A selecction Filter:

load attached .vlx
Call it via (C:Mor:Filter) and select some objects (reconizes also pre-selection - (ssgetfirst) -).
Then go trough the Menu an have a look wich objects do u like most.
If u leftclick the current displayed selection is the new current selection (sssetfirst nil displayedSelection).
If u rightclick, all other are selected.

Its running in while-loop until the user press escape.

The filter is build from this Input:
Code: [Select]
'((object Layer Color xData)
    (xData nil
        (lambda (en / xData)
            (setq xData (cdr (assoc '-3 (entget en '("*")))))
            (if xData
                (cons (mapcar 'car xData) en)
                (cons "no-Xdata" en)
            )
        )
    )
    (Layer nil
        (lambda (en / )
            (cons
                (cdr (assoc 8 (entget en)))
                en
            )
        )
    )
    (BlockName nil
        (lambda (en / color tColor ent)
            (setq ent (entget en))
           
            (if (eq (cdr (assoc 0 ent)) "INSERT")
                (cons (cdr (assoc 2 ent)) en)
            )
        )
    )
    (Closed-p nil
        (lambda (en / )
            (cons
                (if (= (vla-get-closed (vlax-ename->vla-object en)) :vlax-true)
                    "closed"
                    "open"
                )
                en
            )
        )
    )
    (Scaled nil
        (lambda (en / color tColor ent)
            (setq ent (entget en))
           
            (if (eq (cdr (assoc 0 ent)) "INSERT")
                (cons
                    (if (= (cdr (assoc 41 ent)) (cdr (assoc 42 ent)) (cdr (assoc 43 ent)))
                        "uniform"
                        "non-uniform"
                    )
                    en
                )
            )
        )
    )
    (object (LINE:length INSERT:BLOCKNAME INSERT:Scaled LWPolyline:Closed-p hatch:PatternName)
        (lambda (en / )
            (cons
                (cdr (assoc 0 (entget en)))
                en
            )
        )
    )
    (PatternName nil
        (lambda (en / )
            (cons
                (vla-get-PatternName (vlax-ename->vla-object en))
                en
            )
        )
    )
    (Length nil
        (lambda (en / Key)
            (if    (>    (distance
                        (cdr (assoc 10 (entget en)))
                        (cdr (assoc 11 (entget en)))
                    )
                    0
                )
                (setq Key "non-zero")
                (setq Key "zero")
            )
            (cons
                Key
                en
            )
        )
    )   
    (Color (byLayer:Layer)
        (lambda (en / color tColor)
            (setq color (cdr (assoc 62 (entget en))))
            (setq tColor
                (cadr
                    (assoc color
                        (list
                            '(nil "byLayer")
                            '(1 "red")
                            '(2 "yellow")
                            '(3 "green")
                            '(4 "cyan")
                            '(5 "blue")
                            '(6 "magenta")
                            '(7 "black/white")
                            '(8 "dark grey")
                            '(9 "light grey")
                        )
                    )
                )
            )
            (cons
                (vl-princ-to-string (if tColor tColor color))
                en
            )
        )
    )
)
Nothing complicated and easy to modify (for me ;) I guess)....

Tell me what u think...
Greets reltro
« Last Edit: August 31, 2014, 04:17:33 PM by reltro »

77077

  • Guest
Re: Grread OverHead to enable "shapes"
« Reply #4 on: September 28, 2014, 08:38:05 PM »
Thanks reltro.