David Bethel 发表于 2022-7-6 07:28:27

The same could be expressed as:
 

(cond ((and                     )       )   ((and            )       )   (      ))
 
 
-David

neophoible 发表于 2022-7-6 07:33:36

 
In case it was missed, the answer is that you CAN use them, but the point is already a list.You made it an embedded list, and that doesn't work as straightforwardly.

samifox 发表于 2022-7-6 07:38:23

hi
 
for what reasom the main() is not calling to getTotalLength()?

(defun c:main () (setq totLng getTotalLength) (princ) )(defun getTotalLength ( / ptst pten d n6 n8 n1 n2 n k stpt enpt ) (princ "getting the total length of the line") (setq ptst (getpoint "\nStart point of line : ")) (setq pten (getpoint ptst "\nEnd point of line : ")) (setq ptst (trans ptst 1 0) pten (trans pten 1 0)) (setq d (distance ptst pten)) )(defun getSegmentLength () (princ) )
 
Thanks
Shay

Lee Mac 发表于 2022-7-6 07:42:07

To solve your error:

(defun c:main ( / totLng )   (setq totLng (getTotalLength))   (princ))(defun getTotalLength ( / ptst pten d )   (princ "getting the total length of the line")   (setq ptst (getpoint "\nStart point of line : "))   (setq pten (getpoint ptst "\nEnd point of line : "))   (setq ptst (trans ptst 1 0)         pten (trans pten 1 0)   )   (setq d (distance ptst pten)))(defun getSegmentLength ( )   (princ))However, for what the code is doing, it could be simply:

(defun c:main ( / totLng )   (setq totLng (getdist "\nPick Distance: ")))

samifox 发表于 2022-7-6 07:45:14

Thanks Lee
 
i need the ptst and pted location so i cant use getdist()
 
http://www.cadtutor.net/forum/showthread.php?77725-divide-a-line-equally-but-with-a-few-restrictions&highlight=samifox

samifox 发表于 2022-7-6 07:52:09

hi
 
im learning how too access element in lists , why its so hard?
 
i tried to write a program that assign 1-10 to a veriable and thanprints all elements one by one. of course i end up with ugly error
 
how to do it right?
 

;**accessing single element of a list page 17*;(defun c:abcd() (setq pt1(list 1 2 3 4 5 6 7 8 9 0)) (princ (car pt1)) (princ (cdar '(pt1))) )
 
Thanks
Shay
页: 1 [2]
查看完整版本: ABC's of Autolisp by Geor