Recent Posts

Pages: 1 2 3 [4] 5 6 ... 10
This is solution:

(Defun HALF (/ a b c d)
(SETQ A (GETPOINT "\nFirst Point ")
B (GETPOINT A "\nOther Point "))
(defun c:m2p (/)
(setq c (half))
(setq d (getpoint "Line second point: "))
(command "line" c d ""))
Yes,  (command "line" point1 point2 "") would be the right way for this lisp. The result of the half lisp for the start point of the line, and then a free chosen point for the second point and then the "" to end the lisp.
I unfortunatly dont know how to fix it. Not realy much that I know about lisp programming.
I don't understand you quite well. You get (0,0) point cause it's second point parameter. If you want some other point, just change that. For example: (command "line" point1 point2 ""). point1 and point2 are variables or fix values as list '(x y).

You have to look at a command and how it's working in the command line. In same way you provide parameters for (command "commandName" param1 param2 ....). So, line has minimum two points as parameters. You can provide more points to generate more lines. At the end, there must be "" to tell that "line" command has to stop.
General discussion about BabaCAD / Re: m2p funtion as transparent funktion?
« Last post by babadmin on November 25, 2017, 08:31:39 pm »
BabaCAD already has Osnap for midpoint, for Line and Arc objects. I will just extend that for polylines. Everyone who want can put your m2p.lsp to bcad.mnu (in Support folder) to load that lisp at startup, so it will function same as a built-in command.
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.
Pages: 1 2 3 [4] 5 6 ... 10