Discussion in english > General discussion about BabaCAD

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

<< < (3/4) > >>

calubax:
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 )

calubax:
here,drawing m2ptest2.dxf

babadmin:
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.

calubax:
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.

babadmin:
This is solution:

(Defun HALF (/ a b c d)
(SETQ A (GETPOINT "\nFirst Point ")
B (GETPOINT A "\nOther Point "))
(POLAR A (ANGLE A B)(/ (DISTANCE A B) 2)))
(defun c:m2p (/)
(setq c (half))
(setq d (getpoint "Line second point: "))
(command "line" c d ""))

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version