Recent Posts

Pages: 1 [2] 3 4 ... 10
General discussion about BabaCAD / m2p funtion as transparent funktion?
« Last post by calubax on November 25, 2017, 01:24:28 pm »
maybe the m2p should work as a tranparent funktion after calling comands like line, polyline, circle, rectangle, insertion Block and so on. Thats how it works in Autocad - what would you think about that program scheme?
here,drawing m2ptest2.dxf
hello babadmin,
the lisp changes had that result(m2ptest1.dxf). When deleting the line there is no startpoint
left -  thats ok, but that the line automatly ends at the 0,0 point is of cause not wanted.

My version of the lisp worked fine - but the thing with that point left after erasing the line (startpoint perhaps caused from the half comand? i donīt know - it is not so good in large drawings - what is this point - at the moment there is no Point definded in the Program - what could it then be?)
(attachemts m2ptest1.dxf, m2p.lsp )
You have bug in your m2p.lsp cause your second point parameter is bad and third parameter must be "" (to specify end of command, as line command does not end until last space or enter key).

You have three parameters: (half) 0.0 0.0, but 0.0 0.0 must be enclosed in parenthesis like this '(0.0 0.0) or "0.0 0.0". Also, "line" command must have "" at the end. So, your m2p.lsp must look like this:

(Defun HALF (/ a b)
(SETQ A (GETPOINT "\nFirst Point ")
B (GETPOINT A "\nOther Point "))
(defun c:m2p (/)
(command "line" (half) '(0.0 0.0) ""))
Hello babadmin,
here with the attachment version (m2P.lsp) everything works fine.
Maybe that funktion better could be included globaly to the fetch functions that are already bulid in.
 What I have found is that if I erase the line that was created with the m2p funktion the startpoint of the line stays there (looks like a Point). This rest (that Point, startpoint) of the erased line must then separatly erased.

It can do all same in BabaCAD too. I just gave example with block insert (command "insert"), but you can use any command.
If you want use mid point for line, than put (command "line" (half) '(25 30) "") , and this will draw line with startPoint= [midpoint as output calculated from func 'half'] and lastPoint=[some point ex. 25,30], or you can put some other variable instead of exact value for second point.
Yes, this works fine! - but in Autocad this function makes it possible to make much more than  just inserting a block.

So, if for example a line, point or something future input should work with the half lisp function of cause every input (line, rectangle, circle, point, xline an so on) has to get its on Half.lsp or m2p..... much work...
Copy this to m2p.lsp file

(Defun HALF (/ a b)
(SETQ A (GETPOINT "\nFirst Point ")
B (GETPOINT A "\nOther Point "))
(defun c:m2p (/)
(command "insert" "b1" (half) 1.0 0.0))

Block named 'b1' must exists in drawing before starting command 'm2p' in BabaCAD. I've tested this lisp with success.
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
(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
Pages: 1 [2] 3 4 ... 10