Jump to content
Cad2762

Help needed with a Macro please

Recommended Posts

Cad2762

Hi All

 

I cave created a new drop down menu using the Customize User Interface in AutoCad 2011 called Load Aerial Photography with a sub menu called Insert Tiles.

When selecting my new menu I would like to have a macro that browses to where our JPEG Aerial Photos are kept on our network.

 

At the moment I have to select the AutoCad pull down:-

Insert, Raster Image Referance then browse to M:\DATA\AERIAL_PHOTOS\2012\84235\RGB_10cm_1km_Jpeg_Tiles

If there is a user on this Forum who can put together a Macro that will browse to the above filepath I would be very grateful as I'm really getting nowhere with this.

 

Thanks

 

Paul

Share this post


Link to post
Share on other sites
ReMark

Is it possible that the slashes have to go the other way? Like this: / instead of like this \.

 

According to a reference book I have the "/" character is used to define directories. Ex. - C:/0000/bolt.dwg

Share this post


Link to post
Share on other sites
Cad2762
Is it possible that the slashes have to go the other way? Like this: / instead of like this \.

The example I have given Isnt my attempt at writing the Macro its the long handed way of inserting a raster image into a drawing, what I need is someone with Macro experiance to put together a piece of Macro code that will look to the file path I have provided, hope that makes sense.

Share this post


Link to post
Share on other sites
ReMark

You are writing a path to a directory. Reverse the slash.

Share this post


Link to post
Share on other sites
Cad2762
You are writing a path to a directory. Reverse the slash.

 

Thats the point i'm not writing anything as I don't have the experiance to write Macros, if you look at a macro it has instructins like (defun c:/ (((****)) etc

Share this post


Link to post
Share on other sites
ReMark

If you are looking at something like this...

 

(defun c:addtxt ( / i n r s )

 

...then aren't you using a lisp routine not a macro?

Share this post


Link to post
Share on other sites
ReMark

Here is an example of a complex macro (courtesy of CADTech Seminars).

 

^C^C_-layer;make;TAGS;color;red;;;_-insert;c:/blocks/tag.dwg;\96;96;;\_insert;c:/blocks/scale96.dwg;$m=$(getvar,lastpoint);96;96;;_pline;$m=$(getvar,lastpoint);w;1;;\;_insert;c:/block/tag2.dwg;end;\96;96;;\\plinewid;0;

Share this post


Link to post
Share on other sites
Cad2762
If you are looking at something like this...

 

(defun c:addtxt ( / i n r s )

 

...then aren't you using a lisp routine not a macro?

 

This is c copy from my CUI where it says Macro in the properties box (if c:a4comm nil (load "c:/data/lisp/a4comm"));a4comm;

Share this post


Link to post
Share on other sites
ReMark

That macro is calling a lisp routine. Do you know what a lisp routine is?

Share this post


Link to post
Share on other sites
Cad2762

Would you know how to put a Macro together that allow my to insert my JPEG using Insert, Raster Image Referance M:\DATA\AERIAL_PHOTOS\2012\84235\RGB_10cm_1km_Jpeg _Tiles?

Share this post


Link to post
Share on other sites
ReMark

How's this?

 

^C^C-insert;M:/DATA/AERIAL_PHOTOS/2012/84235/RGB_10cm_1km_Jpeg_Tiles/insert tile name with file type here;

Share this post


Link to post
Share on other sites
ReMark

SampleLispRoutine.JPG

An example of a short lisp routine as created by forum member Lee Mac.

See the difference between a macro and a lisp routine?

Share this post


Link to post
Share on other sites
Cad2762

Yes, It's because if you loog at the image you will see in the properties box the lisp routing is title Macro.CUI.JPG

Share this post


Link to post
Share on other sites
ReMark

That's your comeback? We're beyond that now. I wrote what I considered to be a macro that will insert a jpeg located according to the path you provided. All you have to do is add the complete file name, add the macro to your CUI and test.

Share this post


Link to post
Share on other sites
Cad2762
How's this?

 

^C^C-insert;M:/DATA/AERIAL_PHOTOS/2012/84235/RGB_10cm_1km_Jpeg_Tiles/insert tile name with file type here;

 

Thanks but I had tried this already, I think the problem is -insert only allows .dwg and .dxf and not jpeg files, to get a raster image in you have to use insert, Raster Image Referance or imageattach

Share this post


Link to post
Share on other sites
ReMark

Now I'm not so sure. Is there any way to invoke IMAGEATTACH without opening a dialog box?

Share this post


Link to post
Share on other sites
Cad2762

I have already tried this and it does not work, thanks for your imput though

Share this post


Link to post
Share on other sites
Tuns

^C^C-insert;M:/DATA/AERIAL_PHOTOS/2012/84235/RGB_10cm_1km_Jpeg _Tiles;\1;0;

Does this work?

Share this post


Link to post
Share on other sites
Cad2762
^C^C-insert;M:/DATA/AERIAL_PHOTOS/2012/84235/RGB_10cm_1km_Jpeg _Tiles;\1;0;

Does this work?

Thanks but got the message in the picture

 

cui2.jpg

Share this post


Link to post
Share on other sites
Tuns

-image;attach;M:/DATA/AERIAL_PHOTOS/2012/84235/RGB_10cm_1km_Jpeg _Tiles;\1;0;

How about this? Make sure the file path and image name is correct.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×