TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: MSTG007 on December 08, 2017, 07:53:46 AM
-
I am playing around with drawing a simple grid for details. However, I get mixed results on different PC's. Some the grid comes in correctly. Others it looks like the below image or similar. I have straight forward commands and did not know if I need to add more "feneese" to it.
thanks again
(defun c:GRID()
(command "-layer" "s" "TBTXT" "")
(command "_.pline" "9.1875,23.375" "9.1875,11.5335" "")
(command "_.pline" "16.875,23.375" "16.875,11.5335" "")
(command "_.pline" "24.5625,23.375" "24.5625,11.5335" "")
(command "_.pline" "1.5,11.5335" "32.25,11.5335" "")
(command "_.pline" "12.25,11.5335" "12.25,0.625" "")
(command "_.pline" "21.5048,11.5335" "21.5048,0.625" "")
(command "_.pline" "1.5,17.3256" "32.2400,17.3256" "")
(princ)
); defun
(C:GRID)
-
Maybe you can use THIS (https://www.theswamp.org/index.php?topic=25575.msg312811#msg312811).
-
Thanks Ron... I was looking through the code... I remembered the parking routine you helped me with. Im gonna look at that again. I think I can figure that out.
-
Thanks Ron... I was looking through the code... I remembered the parking routine you helped me with. Im gonna look at that again. I think I can figure that out.
I forgot about that parking stall code (https://www.theswamp.org/index.php?topic=51356.msg564808#msg564808)! :) Glad you're using it.
-
I forgot about that parking stall code (https://www.theswamp.org/index.php?topic=51356.msg564808#msg564808)! :) Glad you're using it.
I like this one! :thumbsup:
-
I forgot about that parking stall code (https://www.theswamp.org/index.php?topic=51356.msg564808#msg564808)! :) Glad you're using it.
I like this one! :thumbsup:
Thanks! :)
-
The main problem with the OP's code is the fact that the OSMODE setting will have an impact on the outcome.
-
Im curious.... How does the OSMODE mode have an effect?
-
When using commands inside your Lisp code the OSMODE setting is respected. So if in your code you draw a polyline from point A and an object snap is available at that point, the command will use that snap point instead of the provided coordinates. Of course the current zoom factor and APERTURE setting play a role as well explaining your 'mixed results'.
To fix the issue you can temporarily set the OSMODE to zero in your code.
-
Refer: https://www.theswamp.org/index.php?topic=53652.0
-
Simple answer
(defun c:GRID()
(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0)
(command "-layer" "s" "TBTXT" "")
(command "_.pline" "9.1875,23.375" "9.1875,11.5335" "")
(command "_.pline" "16.875,23.375" "16.875,11.5335" "")
(command "_.pline" "24.5625,23.375" "24.5625,11.5335" "")
(command "_.pline" "1.5,11.5335" "32.25,11.5335" "")
(command "_.pline" "12.25,11.5335" "12.25,0.625" "")
(command "_.pline" "21.5048,11.5335" "21.5048,0.625" "")
(command "_.pline" "1.5,17.3256" "32.2400,17.3256" "")
(setvar 'osmode oldsnap)
(princ)
); defun
(C:GRID)
-
You guys are on it! Thank you.
Tested it on several PC's. No issues when tested and worked.
-
Yes, "osmode" setting is the trick.
BTW from HELP, it gives info of "osmode"
Type: Integer
Saved in: Registry
IOW, "osmode" setting is not stored in drawing file.
This explains that PCs may show different results when the same LSP loaded.
-
Also u can use : "_non" after command to deactivate osnap temporarily.