Hi,
I want to insert another drawing layout tabs contents in current drawing.
It's easy for MODEL tab, but for LAYOUT tabs, I dont know how!?
I prepared a code for INSERTING MODEL tab in current drawing:
(defun INS_DWG (TAB path dwg P / blk) (setq blk (strcat "\"*" path dwg "\"")) ;(setq N (vla-get-count (vla-get-layouts)));;Number of LAYOUT TABS in dwg (if (or(= TAB 0) (= TAB nil))(command "INSERT" blk P 1 0)); TAB=0 or omitted ==>Insert MODEL ;(if (= TAB 1));==>Insert the 1st LAYOUT in dwg file ;(if (= TAB 2));==>Insert the 2nd LAYOUT in dwg file ;and so on.... ); ;;usage: ;;(INS_DWG 0 "c:\\test\\" "test.dwg" '(0 0))
so, can you help me please to complete this code?
Thanks
I'm just curious. When you create a new Layout from template and choose the drawing and tab that you want, does it not bring everything from that Layout with it? It works for me.
Hi,
if you draw anything in Layout tabs or insert a TitleBlock directly into Layout tabs, you can't see anythings in MODEL space!
Thanks for your answer.
Abbas
Hi,
please draw some lines in one drawing but in Layout space not in Model space.
then save this file (c:\test\test.dwg) and open another drawing for example:
(command "new" "acadiso.dwt")
now, in this drawing load my above code:
appload ==> INS_DWG.lsp
then use my code to inset test.dwg to current drawing:
(INS_DWG 0 "c:\\test\\" "test.dwg" '(0 0))
now, test.dwg file inserted in current drawing but you can't see your drwan lines because this code just
insert MODEL space not LAYOUT spaces.
Thanks,
Abbas
I believe that you will have to load the Layout completely to the new drawing.
(defun INS_DWG (TAB path dwg P / blk) (setq blk (strcat "\"*" path dwg "\"")) ;(setq N (vla-get-count (vla-get-layouts)));;Number of LAYOUT TABS in dwg (if (or(= TAB 0) (= TAB nil))(command "INSERT" blk P 1 0)); TAB=0 or omitted ==>Insert MODEL (if (= TAB 1)(COMMAND "LAYOUT" "T" blk "Layout1"));==>Insert the 1st LAYOUT in dwg file asuming that you follow the exact steps you provided to me ;(if (= TAB 2)(COMMAND "LAYOUT" "T" blk "Layout2"));==>Insert the 2nd LAYOUT in dwg file ;and so on.... )
Notice a new drawing always includes Layout1 & Layout2 - unless you are utilizing a custom DWT? If you know the name of the Layout it is easy. Depending on your situation, you may want to delete the existing Layouts that already use the names you are loading. Such as:
(COMMAND "LAYOUT" "D" "Layout1")
(COMMAND "LAYOUT" "D" "Layout2")
I'm almost positive that the new layouts will fail to load if the name already exist, but I may be wrong about that part.
OR,
You will have to, at the very least:
(setvar "ctab" "DESIRED-TAB")
somewhere in your code.
I just thought of one more thing. Since the scale is different btween model space and paper space, after you follow your example, try zoom extents. I may be that your lines did load but they are so large that you cannot see them on the paper and you'll have to scale them to fit. Just a brain fart.
Hi,
Thanks for your answers.
your suggestion:
(command "new" "acadiso.dwt")
(setq path "c:\\test\\" dwg "test.dwg" blk (strcat path dwg))
(COMMAND "LAYOUT" "T" blk "1234")
works, but it just added "1234" layout space of test.dwg to current drawing as a layout space!
but I'm looking for: inserting contents of another drawing's layout to Model space of current drawing.
Thanks again,
Abbas