Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Osmode won't set/Line not visible during command
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Osmode won't set/Line not visible during command (Read 576 times)
0 Members and 1 Guest are viewing this topic.
jlogan02
Bull Frog
Posts: 327
Osmode won't set/Line not visible during command
«
on:
December 12, 2022, 04:04:35 PM »
Can't seem to set the osmode to 39 during the command. I start by setting it to something other than 39, execute the command and whatever I set it to prior to execution remains.
Code - Auto/Visual Lisp:
[Select]
(
defun
c:foo
(
/
*error*
osm pt1 pt2
)
(
defun
*error*
(
msg
)
(
if
osm
(
setvar
'osmode osm
)
)
(
if
(
not
(
member
msg '
(
"Function cancelled"
"quit / exit abort"
)
)
)
(
princ
(
strcat
"
\n
Error: "
msg
)
)
)
(
princ
)
)
(
setq
osm
(
getvar
'osmode
)
)
(
setq
pt1
(
getpoint
"
\n
Specify first point"
)
)
(
setq
pt2
(
getpoint
"
\n
Specify next point"
)
)
(
setvar
'osmode
39
)
(
command
".line"
pt1 pt2
)
(
setvar
'osmode osm
)
(
princ
)
)
Also, the line doesn't appear after I pick the first point. It does when typing line at the command line.
Layer is not locked or frozen.
Layer is current.
Layer color does not match background.
Graphics performance turned off.
Logged
J. Logan
ACAD 2018
I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10
Lee Mac
Seagull
Posts: 12913
London, England
WWW
Re: Osmode won't set/Line not visible during command
«
Reply #1 on:
December 12, 2022, 04:26:17 PM »
Note that you are acquiring the points using the
getpoint
expressions, hence the
OSMODE
would need to be set prior to these expressions. To display a "preview" you can supply the second
getpoint
expression with the first point, representing "rubber band" argument.
Code - Auto/Visual Lisp:
[Select]
(
defun
c:foo
(
/
*error*
osm pt1 pt2
)
(
defun
*error*
(
msg
)
(
if
osm
(
setvar
'osmode osm
)
)
(
if
(
not
(
member
msg '
(
"Function cancelled"
"quit / exit abort"
)
)
)
(
princ
(
strcat
"
\n
Error: "
msg
)
)
)
(
princ
)
)
(
setq
osm
(
getvar
'osmode
)
)
(
setvar
'osmode
39
)
;; Set OSMODE here
(
if
(
and
(
setq
pt1
(
getpoint
"
\n
Specify first point"
)
)
(
setq
pt2
(
getpoint
"
\n
Specify next point"
pt1
)
)
;; Supply rubber band argument
)
(
command
"_.line"
"_non"
pt1
"_non"
pt2
)
)
(
setvar
'osmode osm
)
(
princ
)
)
Logged
Lee Mac Programming
•
Twitter
•
Exchange App Store
jlogan02
Bull Frog
Posts: 327
Re: Osmode won't set/Line not visible during command
«
Reply #2 on:
December 12, 2022, 04:49:05 PM »
My first attempt had
Code - Auto/Visual Lisp:
[Select]
(
setvar
'osmode
36
)
where you have it, and it wasn't working, so I moved it to where the OP shows. Had I added the pt1 for rubber banding, I wouldn't have gotten the results I was getting, which was a fail.
Thanks
Logged
J. Logan
ACAD 2018
I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10
jlogan02
Bull Frog
Posts: 327
Re: Osmode won't set/Line not visible during command
«
Reply #3 on:
December 12, 2022, 04:49:35 PM »
36...39...whatever.
Logged
J. Logan
ACAD 2018
I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Osmode won't set/Line not visible during command