PDA

View Full Version : Help needed with a Macro please



paul.killick559601
2013-10-22, 08:54 AM
Hi All
Sorry if I'm getting Macro & Lisp confussed but if I explain what I would like to achieve then perhaps someone on here can help.
I'm using AutoCad 2011 and using the Customize User Interface have created a new menu so nesting next to the standard AutoCad menus I now have a new pull dowm menu titled Load Aerial Photography with a sub menu titled Select Tiles.
What I would like to happen is when I select Load Aerial Photography then Select Tiles is to have a Macro that browses to the network folder where our Aerial Photography JPEG file are kept.
At the moment each time I need to insert an Aerial Photography JPEG file I have to select:-
Insert then Raster Image Reference then browse to M:\DATA\AERIAL_PHOTOS\2012\84235\RGB_10cm_1km_jpeg_tiles
I would be very grateful if someone on here with Macro skills could put togeter a Macro that I could place in my new CUI Menu.

Thanks
Paul

tedg
2013-10-22, 02:52 PM
Hi All
Sorry if I'm getting Macro & Lisp confussed but if I explain what I would like to achieve then perhaps someone on here can help.
I'm using AutoCad 2011 and using the Customize User Interface have created a new menu so nesting next to the standard AutoCad menus I now have a new pull dowm menu titled Load Aerial Photography with a sub menu titled Select Tiles.
What I would like to happen is when I select Load Aerial Photography then Select Tiles is to have a Macro that browses to the network folder where our Aerial Photography JPEG file are kept.
At the moment each time I need to insert an Aerial Photography JPEG file I have to select:-
Insert then Raster Image Reference then browse to M:\DATA\AERIAL_PHOTOS\2012\84235\RGB_10cm_1km_jpeg_tiles
I would be very grateful if someone on here with Macro skills could put togeter a Macro that I could place in my new CUI Menu.

Thanks
Paul

Congrats on your first post.

Maybe you can post what your macros look like now?
I'm assuming it's a toolbar macro?

Coloradomrg
2013-10-22, 03:03 PM
Here is a start for a macro - I'm not sure about setting a default filepath though. For that I think you'd need a quick lisp routine, and then assign a button to that command.

This will set whatever layer current that your image should be on, and then start the specific command to attach an image.


^C^C-la;s;yourlayername;;_imageattach;

Tom Beauford
2013-10-22, 03:36 PM
If you're using AutoCAD Map use the _mapiinsert command instead of _imageattach or it will not insert at the correct coordinates.

Looking at Ted's signature and mine you can see what software releases we are using. It's helps to get relative responses to your posts.
Congrads on you first post!

bhull1985403354
2013-10-22, 03:51 PM
Please take a look at the following


(Defun c:foo ()
(startapp
(strcat "explorer /select, "
(getvar "dwgprefix")
(getvar "dwgname")
", /e"))
)

this is pbejse's routine that will open the windows folder of the current drawing, where it's located
to call from the CUI you'd create an item and put this as the macro:
^C^C(if (setq x (findfile "foo.lsp"))(load x));foo;

with the lisp file placed somewhere within your support file search paths.
So if your autocad drawing is in the same location as your jpegs, then this would do exactly what you're needing.
If the JPEGs are in a different location, well then you'd just modify this program to open the folder in which they are.
hope that helps..