how to get this lsp to work?

stephen4444

Usenet Archive
Joined
Aug 8, 2003
Messages
31
Reaction score
0
(command "LINE" P1 P2 "")(setq MV1 (ENTLAST))
(command "LINE" P3 P4 "")(setq MV2 (ENTLAST))
(command "LINE" P5 P6 "")(setq MV3 (ENTLAST))
(if (= MV1 nil)(null MV1))
(if (= MV2 nil)(null MV2))
(if (= MV3 nil)(null MV3))
(if (/= nil)(command "MOVE" MV1 "" P1 P7))
(if (/= nil)(command "MOVE" MV2 "" P3 P7))
(if (/= nil)(command "MOVE" MV3 "" P5 P7))

What I am trying to do is:
If a line is drawn from P1 to P2 then move MV1 from P1 to P7. If a line is NOT drawn from P1 to P2 then DONT move MV1 from P1 to P7. (same for MV2 & MV3)

But the problem I am having is:
After I run the command like line from P1 to P2 it moves fine to MV1. Then if I run the command again like line from P3 to P4 it moves to MV2, but entity MV1 move again!

Even though MV1, MV2, & MV3 entities are defined,
how can I only move MV2 but not the others? or undefine entities MV1 & MV3? or rewrites so it does the same thing.

Hope I'm making sense.

TIA
 
If you are going to draw the line via lisp, then why not draw it in the correct location to begin with?

To answer your question though, your if statements are a bit out of sorts.

Again, without seeing all that you are trying to accomplish, given what you are showing there is no need to evaluate MV1, 2, and 3 because they're always going to be set to a line entity.

Below shows what your if statements should look like given your example.

(command "LINE" P1 P2 "")
(setq MV1 (ENTLAST))
(command "LINE" P3 P4 "")
(setq MV2 (ENTLAST))
(command "LINE" P5 P6 "")
(setq MV3 (ENTLAST))
(if MV1
(command "MOVE" MV1 "" P1 P7)
)
(if MV2
(command "MOVE" MV2 "" P3 P7)
)
(if MV3
(command "MOVE" MV3 "" P5 P7)
)
stephen4444 said:
(command "LINE" P1 P2 "")(setq MV1 (ENTLAST))
(command "LINE" P3 P4 "")(setq MV2 (ENTLAST))
(command "LINE" P5 P6 "")(setq MV3 (ENTLAST))
(if (= MV1 nil)(null MV1))
(if (= MV2 nil)(null MV2))
(if (= MV3 nil)(null MV3))
(if (/= nil)(command "MOVE" MV1 "" P1 P7))
(if (/= nil)(command "MOVE" MV2 "" P3 P7))
(if (/= nil)(command "MOVE" MV3 "" P5 P7))

What I am trying to do is:
If a line is drawn from P1 to P2 then move MV1 from P1 to P7. If a line is NOT drawn from P1 to P2 then DONT move MV1 from P1 to P7. (same for MV2 & MV3)

But the problem I am having is:
After I run the command like line from P1 to P2 it moves fine to MV1. Then if I run the command again like line from P3 to P4 it moves
to MV2, but entity MV1 move again!
Even though MV1, MV2, & MV3 entities are defined,
how can I only move MV2 but not the others? or undefine entities
MV1 & MV3? or rewrites so it does the same thing.
 
thx for the reply.
(that wasn't what I was looking for)
well, let me try ask the question differently.

(setq MV1 (entlast))
How do you undefine MV1? or is possible in lsp?
 
I try that already, but was not working.

finally I got it to work..!!
I just have to redefine MV2:
(setq MV2 MVV) instead (setq MV2 nil)
MVV (new function but just not been used anywhere)

thanks for the help.
 
But...but...If MVV hasn't been "used before," then its value is nil; so (setq MV2 MVV) is equivalent to (setq MV2 nil)
___
 
I'm not sure what isn't working, but in the following code MV1 and MV2 will move. MV3 will not.

(command "LINE" P1 P2 "")
(setq MV1 (ENTLAST))
(command "LINE" P3 P4 "")
(setq MV2 (ENTLAST))
(command "LINE" P5 P6 "")
(setq MV3 (ENTLAST))

(setq MV3 nil)

(if MV1
(command "MOVE" MV1 "" P1 P7)
)
(if MV2
(command "MOVE" MV2 "" P3 P7)
)
(if MV3
(command "MOVE" MV3 "" P5 P7)
)
 

Latest threads

Back
Top