Qonfire Posted June 11, 2012 Posted June 11, 2012 After my terrible vocation in psyhiatric hospital i'm back asking questions (vl-load-com) (setq myFilter (list (cons 0 "LINE") (cons 410 "model"))) (setq alllines (ssget "x" myfilter)) (setq myFilter2 (list (cons 0 "insert") (cons 410 "model"))) (setq alllitems (ssget "x" myfilter2)) (setq acadobj1 (vlax-ename->vla-object (ssname alllines 0))) (setq acadobj2 (vlax-ename->vla-object (ssname alllitems 0))) (setq iPts (vla-intersectwith acadobj1 acadobj2 0)) (setq iPts (vlax-variant-value iPts)) (setq iPts (vlax-safearray->list iPts)) Quote
Qonfire Posted June 11, 2012 Author Posted June 11, 2012 dont remember where i found this lisp, however its says something like variant type is not good,i wonder why (defun get_all_inters_in_SS (SS / SSL ;length of SS PTS ;returning list aObj1 ;Object 1 aObj2 ;Object 2 N1 ;Loop counter N2 ;Loop counter iPts ;intersects ) (setq N1 0 ;index for outer loop SSL (sslength SS) ) ; Outer loop, first through second to last (while (< N1 (1- SSL)) ; Get object 1, convert to VLA object type (setq aObj1 (ssname SS N1) aObj1 (vlax-ename->vla-object aObj1) N2 (1+ N1) ) ;index for inner loop ; Inner loop, go through remaining objects (while (< N2 SSL) ; Get object 2, convert to VLA object (setq aObj2 (ssname SS N2)) aObj2 (vlax-ename->vla-object aObj2) ; Find intersections of Objects iPts (vla-intersectwith aObj1 aObj2 0 ) ; variant result iPts (vlax-variant-value iPts) ) ; Variant array has values? (if (> (vlax-safearray-get-u-bound iPts 1) 0 ) (progn ;array holds values, convert it (setq iPts ;to a list. (vlax-safearray->list iPts) ) ;Loop through list constructing points (while (> (length iPts) 0) (setq Pts (cons (list (car iPts) (cadr iPts) (caddr iPts) ) Pts ) iPts (cdddr iPts) ) ) ) ) (setq N2 (1+ N2)) ) ;inner loop end (setq N1 (1+ N1)) ;outer loop end Pts ) ;return list of points found (setq all (ssget "X")) (get_all_inters_in_SS all) Quote
MSasu Posted June 12, 2012 Posted June 12, 2012 That "e" is used to represent very small, subunitary, coordinates: (expt 10.0 - ;will return 1.0e-008 (princ 0.00000001) ;will return 1.0e-008 May also encounter it for big numbers: (expt 10.0 ;will return 1.0e+008 Quote
pBe Posted June 12, 2012 Posted June 12, 2012 On your first question, what you're seeing is the display value, it is in fact a double-precision floating-point number. It might "look" the same and probably they are but not really. You have a misplaced closing parenthesis on the code you posted (defun get_all_inters_in_SS (SS / SSL ;length of SS PTS ;returning list aObj1 ;Object 1 aObj2 ;Object 2 N1 ;Loop counter N2 ;Loop counter iPts ;intersects ) (setq N1 0 ;index for outer loop SSL (sslength SS) ) ; Outer loop, first through second to last (while (< N1 (1- SSL)) ; Get object 1, convert to VLA object type (setq aObj1 (ssname SS N1) aObj1 (vlax-ename->vla-object aObj1) N2 (1+ N1) ) ;index for inner loop ; Inner loop, go through remaining objects (while (< N2 SSL) ; Get object 2, convert to VLA object (setq aObj2 (ssname SS N2) aObj2 (vlax-ename->vla-object aObj2) ; Find intersections of Objects iPts (vla-intersectwith aObj1 aObj2 0 ) ; variant result iPts (vlax-variant-value iPts)) ; Variant array has values? (if (> (vlax-safearray-get-u-bound iPts 1) 0 ) (progn ;array holds values, convert it (setq iPts ;to a list. (vlax-safearray->list iPts) ) ;Loop through list constructing points (while (> (length iPts) 0) (setq Pts (cons (list (car iPts) (cadr iPts) (caddr iPts) ) Pts ) iPts (cdddr iPts) ) ) ) ) (setq N2 (1+ N2)) ) ;inner loop end (setq N1 (1+ N1)) ) ;outer loop end Pts ) ;return list of points found (setq all (ssget "X" )) (get_all_inters_in_SS all) HTH Quote
Lee Mac Posted June 12, 2012 Posted June 12, 2012 http://en.wikipedia.org/wiki/Scientific_notation#E_notation Quote
Qonfire Posted June 12, 2012 Author Posted June 12, 2012 z is 10000000 ? switching to 2d workspace you think might help? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.