Need Help modify Grid lisp routine

Need Help modify Grid lisp routine

cesarmorin11
Explorer Explorer
1,292 Views
9 Replies
Message 1 of 10

Need Help modify Grid lisp routine

cesarmorin11
Explorer
Explorer

cesarmorin11_0-1620162059176.png(Sample)

Some one could please modify the lisp to eliminate the perimeter lines marked by an X.

 

Thanks

0 Likes
1,293 Views
9 Replies
Replies (9)
Message 2 of 10

ВeekeeCZ
Consultant
Consultant

The author @Lee_Mac himself has been spotted active here lately. I'm sure that Lee will make this tweak for you when he finds a minute.

Message 3 of 10

Lee_Mac
Advisor
Advisor

This can be achieved with a relatively straightforward modification to the 4 repeat loops which construct the static & dynamic horizontal & vertical lines forming the grid.

 

Change lines 106-109 from:

                (repeat (1+ *cols*)
                    (grdraw pt (list (car pt) (+ (cadr pt) vd)) 1 1)
                    (setq pt (list (+ (car pt) hs) (cadr pt)))
                )

To:

                (repeat (1- *cols*)
                    (setq pt (list (+ (car pt) hs) (cadr pt)))
                    (grdraw pt (list (car pt) (+ (cadr pt) vd)) 1 1)
                )

Change lines 111-114 from:

                (repeat (1+ *rows*)
                    (grdraw pt (list (+ (car pt) hd) (cadr pt)) 1 1)
                    (setq pt (list (car pt) (+ (cadr pt) vs)))
                )

To:

                (repeat (1- *rows*)
                    (setq pt (list (car pt) (+ (cadr pt) vs)))
                    (grdraw pt (list (+ (car pt) hd) (cadr pt)) 1 1)
                )

Change lines 119-128 from:

                (repeat (1+ *cols*)
                    (entmakex
                        (list
                            (cons 0 "LINE")
                            (cons 10 (trans pt 1 0))
                            (cons 11 (trans (list (car pt) (+ (cadr pt) vd)) 1 0))
                        )
                    )
                    (setq pt (list (+ (car pt) hs) (cadr pt)))
                )

To:

                (repeat (1- *cols*)
                    (setq pt (list (+ (car pt) hs) (cadr pt)))
                    (entmakex
                        (list
                            (cons 0 "LINE")
                            (cons 10 (trans pt 1 0))
                            (cons 11 (trans (list (car pt) (+ (cadr pt) vd)) 1 0))
                        )
                    )
                )

And finally, change lines 130-139 from:

                (repeat (1+ *rows*)
                    (entmakex
                        (list
                            (cons 0 "LINE")
                            (cons 10 (trans pt 1 0))
                            (cons 11 (trans (list (+ (car pt) hd) (cadr pt)) 1 0))
                        )
                    )
                    (setq pt (list (car pt) (+ (cadr pt) vs)))
                )

To:

                (repeat (1- *rows*)
                    (setq pt (list (car pt) (+ (cadr pt) vs)))
                    (entmakex
                        (list
                            (cons 0 "LINE")
                            (cons 10 (trans pt 1 0))
                            (cons 11 (trans (list (+ (car pt) hd) (cadr pt)) 1 0))
                        )
                    )
                )

Note that, in each modification, I am simply subtracting 2 from the number of iterations of the loops (corresponding to the 2 outermost horizontal & vertical lines), and re-ordering the expressions within the loop such that the point is offset before the first line is constructed.

Message 4 of 10

martin_leiter
Advocate
Advocate

Hello Mr. Lee,
could you show us how to replace the lines with construction lines?
Because I can't do it.

Please Mr. Lee

0 Likes
Message 5 of 10

Anonymous
Not applicable

Thank you!  this works.😊

0 Likes
Message 6 of 10

Lee_Mac
Advisor
Advisor

Certainly - in either the original code, or the modified code, change:

                            (cons 0 "LINE")
                            (cons 10 (trans pt 1 0))
                            (cons 11 (trans (list (car pt) (+ (cadr pt) vd)) 1 0))

To:

                           '(000 . "XLINE")
                           '(100 . "AcDbEntity")
                           '(100 . "AcDbXline")
                            (cons 10 (trans pt 1 0))
                            (cons 11 (trans (list 0 vd) 1 0))

And change:

                            (cons 0 "LINE")
                            (cons 10 (trans pt 1 0))
                            (cons 11 (trans (list (+ (car pt) hd) (cadr pt)) 1 0))

To:

                           '(000 . "XLINE")
                           '(100 . "AcDbEntity")
                           '(100 . "AcDbXline")
                            (cons 10 (trans pt 1 0))
                            (cons 11 (trans (list hd 0) 1 0))

 

0 Likes
Message 7 of 10

Lee_Mac
Advisor
Advisor

Excellent! You're most welcome 🙂

Message 8 of 10

martin_leiter
Advocate
Advocate

Hello Mr. Lee,

thank you very much for the change. It works very well.
Unfortunately, it does not work in the BKS. The construction lines are there somewhere.

Thank you Mr. Lee!

0 Likes
Message 9 of 10

ВeekeeCZ
Consultant
Consultant

Just curious what bks means?

0 Likes
Message 10 of 10

martin_leiter
Advocate
Advocate

UCS