Two Commands to be Run Individually on each piece of Mtext In a Drawing

Two Commands to be Run Individually on each piece of Mtext In a Drawing

Anonymous
Not applicable
954 Views
4 Replies
Message 1 of 5

Two Commands to be Run Individually on each piece of Mtext In a Drawing

Anonymous
Not applicable

Hi all,

You may want to disregard the title as I really didn't know how to describe what I'm trying to do with one sentence haha. What I need is a macro, lisp, or recorded action that will let me run through a set of Mtext objects and run two different already created lisp routines on each piece of Mtext that is on a certain layer. Basically it would do this:

 

1) Run a lisp routine titled: "Fiber-TilePhoto1"

2) Select text "228 477" on layer "B-TILE-NUMB"

3) Once that has completed, run lisp routine "Fiber-TilePhoto2"

4) The macro or lisp would then go to the next piece of mtext on layer "B-TILE-NUMB" and repeat steps 1 thru 3.

5) This macro would run on every piece of mtext on the mentioned layer that exists in the drawing.

 

Is this possible?

 

Thanks!

 

*AutoCAD Map 3D 2019 64 bit on Windows 10*

0 Likes
955 Views
4 Replies
Replies (4)
Message 2 of 5

roland.r71
Collaborator
Collaborator

@Anonymous wrote:

Hi all,

You may want to disregard the title as I really didn't know how to describe what I'm trying to do with one sentence haha. What I need is a macro, lisp, or recorded action that will let me run through a set of Mtext objects and run two different already created lisp routines on each piece of Mtext that is on a certain layer. Basically it would do this:

 

1) Run a lisp routine titled: "Fiber-TilePhoto1"

2) Select text "228 477" on layer "B-TILE-NUMB"

3) Once that has completed, run lisp routine "Fiber-TilePhoto2"

4) The macro or lisp would then go to the next piece of mtext on layer "B-TILE-NUMB" and repeat steps 1 thru 3.

5) This macro would run on every piece of mtext on the mentioned layer that exists in the drawing.

 

Is this possible?

 

Thanks!

 

*AutoCAD Map 3D 2019 64 bit on Windows 10*


Hmmm, it sounds a bit confusing, so... you want 2 lisp routines to be run on each MTEXT on layer "B-TILE-NUMB" (?)

 

- Select all MTEXT on layer "B-TILE-NUMB"

- for each text

- Run the lisp routine "Fiber-TilePhoto1"

Q: Is the function written to take an active selection? or do you need to supply one as argument? or does it take only a single MTEXT and it needs to be repeated for all?

- Then Run lisp routine "Fiber-TilePhoto2"

Q: Is the function written to take an active selection? or do you need to supply one as argument?

 

It should be possible, but how depends on a few things. Mostly on how those other 2 routines work.

 

Could you share a sample dwg (in a regular old acad format most (incl. me) can read) & the two lisp routines?

0 Likes
Message 3 of 5

Anonymous
Not applicable

Q1 Answer: The lisp will only allow selection of a single mtext string. Basically when you select a certain number which is a label for a "tile", the lisp runs a 3rd party application that goes and grabs a geo-located Google Maps image for the area that the tile represents. It then screen-grabs/cuts the image and references it in that "tile". You do this for all the tile numbers: 228-477, 229-478, 230-478, etc. Once completed, you are left with a mosaic of hundreds of images that make up an overall map area.

 

Q2 Answer: This lisp automatically runs on the image that was placed from the first lisp. Its function is to rename and relatively path the image as a reference.

 

I am just trying to get out of having to run these two commands manually on each tile number in a given map.

 

To your last question, I don't think I could share the lisp routines as they are proprietary to the company I work for. I was just wondering (ignorantly) if there was a way to do this that would be agnostic to which two commands are actually being run. The macro would just run lisp 1, select tile number, run lisp 2 and repeat.

 

Thanks for your reply and sorry if this is confusing.

0 Likes
Message 4 of 5

roland.r71
Collaborator
Collaborator

@Anonymous wrote:

Q1 Answer: The lisp will only allow selection of a single mtext string. Basically when you select a certain number which is a label for a "tile", the lisp runs a 3rd party application that goes and grabs a geo-located Google Maps image for the area that the tile represents. It then screen-grabs/cuts the image and references it in that "tile". You do this for all the tile numbers: 228-477, 229-478, 230-478, etc. Once completed, you are left with a mosaic of hundreds of images that make up an overall map area.

 

Q2 Answer: This lisp automatically runs on the image that was placed from the first lisp. Its function is to rename and relatively path the image as a reference.

 

I am just trying to get out of having to run these two commands manually on each tile number in a given map.

 

To your last question, I don't think I could share the lisp routines as they are proprietary to the company I work for. I was just wondering (ignorantly) if there was a way to do this that would be agnostic to which two commands are actually being run. The macro would just run lisp 1, select tile number, run lisp 2 and repeat.

 

Thanks for your reply and sorry if this is confusing.


Ok, that makes it virtually impossible.

If the lisp works on its own and allows you to select a single entity, you can not use another lisp to select all mtext and feed them 1 by 1 to the first lisp. You'll need to rewrite (part off) that first lisp, to accept a supplied entity (instead of selecting one)

 

A similar problem might arise with the second lisp. (depending on how it "knows" what image was just placed and needs processing)

0 Likes
Message 5 of 5

Anonymous
Not applicable
Thank you. I'll have to talk to my boss about altering the lisp.
0 Likes