command not consistent (pt is never the same)

command not consistent (pt is never the same)

lemoinemarc
Contributor Contributor
987 Views
5 Replies
Message 1 of 6

command not consistent (pt is never the same)

lemoinemarc
Contributor
Contributor

Hi, I'm trying to figure out why a command I made will work sometimes and sometimes will not..I suspect a pt that is not clearing from an other command, but i made sure to include all the variables on the defun line..This is the only function that has this behavior (out of 33)

Maybe I don't use the cad,cadr,caddr like I should?

 

 

(defun c:base01 ( / pt1 pt2 pt4 a1 a2 a3 a4 );base de ciment fenetre
(command "-layer" "make" "00" "" )
(command "ucs" "w" )
(setq pt1 (getpoint))
(setq pt2 (list (car pt1) (cadr pt1) (- (caddr pt1 9))
(setq pt4 (list (car pt1) (cadr pt1) (- (caddr pt1 2))
(command "solidedit" "f" "c" pause "" pt1 pt1 "x" "")
(setq a1 (entlast))
(command "extrude" a1 "" "-2" )
(setq a2 (entlast))
(command "erase" a1 "")
(command "isolateobjects" a2 "" )
(command "solidedit" "f" "o" pause "all" "" "1" "" "" )
(command "unisolateobjects" )
(command "slice" a2 "" "xy" pt4 "0,0,2000" )
(setq a3 (entlast))
(command "slice" a3 "" "xy" pt1 "0,0,-1000" )
(setq a4 (entlast))
(command "chprop" a4 "" "layer" "ciment" "")
(command "-layer" "make" "00" "" )
(princ)

0 Likes
Accepted solutions (1)
988 Views
5 Replies
Replies (5)
Message 2 of 6

Kent1Cooper
Consultant
Consultant
Accepted solution

Do you sometimes have running Object Snap modes in effect?  Does it work correctly when you do not?

Kent Cooper, AIA
Message 3 of 6

lemoinemarc
Contributor
Contributor

I think you are on to something..

  • I positioned a solid so that a top corner is at 0,0,0
  • I disabled Osnap and instead of choosing pt1 with the mouse, i entered 0,0,0
  • the function did it's thing and it worked everytime!

So I guess Disabling Osmode after the pt1 selection? I tried this but it won't work:

 

(defun c:base02 (/ pt1 pt2 pt4 a1 a2 a3 a4 );base de ciment fenetre
(command "-layer" "make" "00" "" )
(command "ucs" "w" )
(setq pt1 (getpoint))
(setvar "osmode" 0)
(setq pt2 (list (car pt1) (cadr pt1) (+ (caddr pt1) 9)))
(setq pt4 (list (car pt1) (cadr pt1) (+ (caddr pt1) 4)))...

 

 

0 Likes
Message 4 of 6

lemoinemarc
Contributor
Contributor

Oups! it works now..I accidentally removed a bracket so it wouldn't load.

As for the solution, I didn't know that Osnap would still work during a function. I understand now that the reason it worked sometimes was that I zoomed enough so that it wouldn't snap to anything else..

thank you! 🙂

0 Likes
Message 5 of 6

Kent1Cooper
Consultant
Consultant

@lemoinemarc wrote:

.... I didn't know that Osnap would still work during a function. ….


 

It works during a (command) function when it's asking for a point.  This is one reason some prefer to draw things with (entmake) instead, when practical, because Osnap doesn't affect the results.  But when there are only a few points to deal with in a routine, it can also be controlled without turning off Osnap by putting "_none" Osnap calls before point entries.

Kent Cooper, AIA
0 Likes
Message 6 of 6

cadffm
Consultant
Consultant

It's also still  working by type in the coords into commandline by hand!

 

A) by hand

B) in automation like macro/script/lisp.. (when then command or function ask for Userinput)

C) both

 

Controlled by one of 1000 options/Variables. Read this - click!

Or just OPTIONS/User preferences/  [Priority for coordinate...]

Sebastian

0 Likes