Jonathan Handojo Posted February 2, 2020 Share Posted February 2, 2020 Hi hackers, How can I use (vla-AddRaster) but not on ModelSpace, rather on a specific layout or tab? Or is there no other way to do it other than: (setvar 'CTAB <name_of_layout>) (command "-insert" "attach" <file_name> <point> <scale> <rotation>) I kinda despise using command as it's the slowest thing to do especially looping through thousands. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted February 2, 2020 Share Posted February 2, 2020 (edited) Use imageattach that works. or vla-AddRaster thespace you need to set the space to paperspace. (setq mspace (vla-get-paperspace (vla-get-activedocument (vlax-get-acad-object)))) Edited February 2, 2020 by BIGAL Quote Link to comment Share on other sites More sharing options...
Jonathan Handojo Posted February 2, 2020 Author Share Posted February 2, 2020 48 minutes ago, BIGAL said: Use imageattach that works. or vla-AddRaster thespace you need to set the space to paperspace. (setq mspace (vla-get-paperspace (vla-get-activedocument (vlax-get-acad-object)))) I actually tried that too, but it went on the wrong layout even after doing (setvar "CLAYOUT" <layout_name>) Quote Link to comment Share on other sites More sharing options...
Jonathan Handojo Posted February 2, 2020 Author Share Posted February 2, 2020 1 hour ago, BIGAL said: Use imageattach that works. or vla-AddRaster thespace you need to set the space to paperspace. (setq mspace (vla-get-paperspace (vla-get-activedocument (vlax-get-acad-object)))) Oh, nevermind, I figured it out... you have to set the paperspace AFTER doing (setvar "CLAYOUT" <layout_name>)... Previously I was doing it BEFORE, hence the reason it failed. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted February 2, 2020 Share Posted February 2, 2020 Add "pspace" just going to the layout you could be in model space. Also (setvar "ctab" name) Quote Link to comment Share on other sites More sharing options...
ronjonp Posted February 3, 2020 Share Posted February 3, 2020 If you use addraster and have the layout name to reference, the tab does not need to be made current .. here's a simple example. (vl-load-com) (setq sp (vla-get-block (vla-item (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) ;; Name of your layout to add raster (car (layoutlist)) ) ) ) ;; Add a line (vlax-invoke sp 'addline '(0. 0. 0.) '(1. 1. 1.)) ;; Add raster (if (setq f (findfile "path to your image")) (vlax-invoke sp 'addraster f '(0. 0. 0.) 1 0) ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.