(foreach layout (layoutlist)(setvar "ctab" layout)(command "pspace")(command "-insert" "d:\new block.dwg" "2527.1006,827.3694" "1" "0"))
second save the foreach as a lisp then script just has two lines this is a universal way of doing it can be used elsehwere
(load "foreachtab")
(foreachtab "d:\new block.dwg" "2527.1006,827.3694")
(foreachtab (blknanme pt / )(foreach layout (layoutlist) (setvar "ctab" layout) (command "pspace") (command "-insert" blkname pt "1" "0"))) OMG i realised something. All layout tabs are names differently across my lots of drawings.
If this is the case, what is the solution? Try this
ATTREQ 1ATTDIA 0(setq osnapsave (getvar "osnap"))(setvar "osnap" 0)(foreach layout (layoutlist) (setvar "ctab" layout) (if (/= 1 (getvar "cvport")) (command "pspace")) (command "-insert" "d:\\new block.dwg" "2527.1006,827.3694" "1" "0"))(setvar "osnap" osnapsave)savey Hi JamCAD
Tested the script as indicated but got this error:-
So i took out this 3 lines(setq osnapsave (getvar "osnap")) (setvar "osnap" 0)
(setvar "osnap" osnapsave)
And also added "1" for the Y scale
This script now is this:-
ATTREQ 1ATTDIA 0(foreach layout (layoutlist) (setvar "ctab" layout) (if (/= 1 (getvar "cvport")) (command "pspace")) (command "-insert" "d:\\new block.dwg" "2527.1006,827.3694" "1" "1" "0"))(setvar "osnap" osnapsave)savey
And manage to get it to work. All layouts regardless of name has the new block inserted.
Thanks bro.
But then kindly advise the purpose of the 3 lines of code & if it is necessary to prevent future errors & how to incoporate it to the script such that it can work correctly.
Thanks again.
Sorry, I'm trying to answer these questions on my phone and I'm not able to test it before I post. Those few lines of code are to disable the object snap so when you are inserting the block it doesn't accidentally snap to the incorrect point. I forgot that the system variable for the osnap settings is actually osmode. This should work now.
ATTREQ 1ATTDIA 0(setq osnapsave (getvar "osmode"))(setvar "osmode" 0)(foreach layout (layoutlist) (setvar "ctab" layout) (if (/= 1 (getvar "cvport")) (command "pspace")) (command "-insert" "d:\\new block.dwg" "2527.1006,827.3694" "1" "1" "0"))(setvar "osmode" osnapsave)savey Hi BIGAL,
do not quite understand the process.
I will just stick to the basic script instead
Thanks for the help as well
NP bro. Appreciate the help.
The revised script now works without issues.
Thanks
I also added this 3 lines to my initial script base on layout names:-
(setq osnapsave (getvar "osmode"))
(setvar "osmode" 0)
(setvar "osmode" osnapsave)
Script
ATTREQ 1ATTDIA 0(setq osnapsave (getvar "osmode"))(setvar "osmode" 0)ctabA2-INSERT"*d:\new block.dwg"2527.1006043527,827.369441206792310ctabA3-INSERT"*d:\new block.dwg"2527.1006043527,827.369441206792310(setvar "osmode" osnapsave)savey Thought this was discussed already OSMODE
OMG. You are right.
Now how did i copied the old code instead?
WIll test it when back in office but i believe should be no issue now.
页:
1
[2]