Discussion in english > General discussion about BabaCAD

How to insert an object via mid of two points (lisp file half.lsp)

(1/4) > >>

Hello Babacad team,
I would like to led the program calculate the point (The mid of two points) to insert an object, a block, line or something else in.
Therefor the lisp program (half.lsp) should start in between. For example - I have drawn two rectangles - now I want to insert an objekt right in the middle of two selected points from the two rectangles.

What I found is that the command structure not enables a user input like to led the Lisp program(attached) calculate the point.
Maybe it could be possible (maybe hopefully in this early babacad progamming state with just a few program line changes)

Another Point to all other Babacad users would be that they could if they tell about lisp programs they already succsessful tested with BabaCAD. That could be very helpful for the comunity.
Best wishes to all

I check it, and it works (one small bug is that first point cursor is 0,0, lisp does not get A point as a start, but it's just visual effect, result of mid point is correct).

You get mid point as list in result of function. Also, to run this as a lisp command in command line you have to add 'c:' in front of HALF function name in this lisp or run as lisp function directly in BabaCAD command line (using brackets), like this (HALF).

Hello babadmin,
could you please write the changes that have to be written in the lisp file and attach it here? I wrote a c: after defun but unfortunatly not worked.

(Defun c:HALF (/ a b)
(SETQ A (GETPOINT "\nFirst Point ")
B (GETPOINT A "\nOther Point "))

then appload, choose half.lsp and type half at command line. That's it.

Updated: I fixed bug in getpoint lisp function (reference point is ok now). Just go download latest Update 2 (21th November late night CETime) from http://www.babacad.com/ext

Hello babadmin,
I did the changes - if I want to insert a block via the half lisp ( selecting two different points for example a point of a rectangle and then another point of another rectangle the block still
inserts on the first selected point - the second point is not being asked for) - the half lisp will not jump into insertion process to takeover the calculation result.

The half lisp program should deliver the coordinats for a start point (object insertion point, line start for example.
Or did I misunderstand the Lisp function.
In Autocad something similar (m2P) makes this work.

Maybe in this could be in the following updates - if it is possible


[0] Message Index

[#] Next page

Go to full version