Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Attribute moving when inserting dynamic block through macro

16 REPLIES 16
SOLVED
Reply
Message 1 of 17
ryled
674 Views, 16 Replies

Attribute moving when inserting dynamic block through macro

I am attempting to insert a block that contains two attributes.  I would like to create a button for it, so I have made a macro but whenever I run this macro my top attribute shifts and relates itself to the origin of the UCS.  The odd thing is that the bottom attribute does not, and this only happens when I insert this block through a macro.  If I insert it through the insert command it comes out okay, but that is only if I did not try the macro already in the drawing.  Quite odd. 

 

The macro I used is:

C^C^C-LAYER;SET;"ELEVATION";;^C^C^C-INSERT;"ELEVATION - MODEL";\

 

I have also tried:

C^C^C-LAYER;SET;"ELEVATION";;^C^C^C-INSERT;"ELEVATION - MODEL";scale;1;rotate;0;

 

 

I have attempted to recreate the top attribute in model space, and in block editor.  Copy/Mirror the bottom attribute in model space and block editor and redefine the values to what I want.  I have also tried setting the UCSICON to noorigin and off in the block editor. 

 

If anyone has any suggestions that would be great! Thank you!

 

I have attached the file below.

16 REPLIES 16
Message 2 of 17
bhull1985
in reply to: ryled

There is an attribute mode called "locked"

Can you lock these attributes in place, for all of your blocks?

I would think that to be the quickest/easiest solution...

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 3 of 17
ryled
in reply to: bhull1985

I have both top and bottom attributes lock position set to yes, which is why I believe it works when using the "insert" command, but I would think it would be the same for the "-insert" command but that doesn't seem to be the case.

Message 4 of 17
ryled
in reply to: ryled

If this would be better suited in another section could someone point me in the right direction? I dont want to make multiple threads on the same topic.

Message 5 of 17
hmsilva
in reply to: ryled

Hi ryled,

 

"whenever I run this macro my top attribute shifts and relates itself to the origin of the UCS"

 

I can't reproduce that behavior, using
^C^C-LAYER;SET;"ELEVATION";;-INSERT;"ELEVATION - MODEL";\
or
^C^C-LAYER;SET;"ELEVATION";;-INSERT;"ELEVATION - MODEL";scale;1;rotate;0;

at AutoCAD 2010 and 2014...

 

Henrique

EESignature

Message 6 of 17
ryled
in reply to: hmsilva

hmsilva,

 

Are you able to insert the block at all?  I have attached a second block with the same problem.  One of the annotative attributes shifts when it is inserted through a macro but the other one stays in place.  If you insert it through the ribbon, either block, the attributes appear in the correct position.  However if I used a macro, or just run it through the command line with "-Insert" one of the attributes shifts and relates its position to the origin.  Perhaps this would be better suited in the dynamic blocks forum, but I thought it was possibly something incorrect I had done in my macro.

 

Running AutoCAD 2012 here for the record.

Message 7 of 17
hmsilva
in reply to: ryled


@ryled wrote:

Are you able to insert the block at all? 


Yes.


@ryled wrote:

 I have attached a second block with the same problem.  One of the annotative attributes shifts when it is inserted through a macro but the other one stays in place.  If you insert it through the ribbon, either block, the attributes appear in the correct position.  However if I used a macro, or just run it through the command line with "-Insert" one of the attributes shifts and relates its position to the origin.  Perhaps this would be better suited in the dynamic blocks forum, but I thought it was possibly something incorrect I had done in my macro.

 

Running AutoCAD 2012 here for the record.


Tested in Autocad 2012

Insert_.PNG

 

Is this expected outcome, correct?

 

Henrique

EESignature

Message 8 of 17
ryled
in reply to: hmsilva

Annotative Pic.gif

 

The result you had gotten  I get when I either A) Insert through the ribbon, or B) insert by typing "Insert" through the command line.  That is what I'm looking for.

 

However I wish to make buttons for these two blocks.  Therefore I need a macro, and with my macros, or through typing "-Insert" into the command line I come out with the placement above.  Notice that in each block one of the annotative attributes places correctly, and one moves to a point relative to the origin.

 

I am unsure as to why.

Message 9 of 17
hmsilva
in reply to: ryled

As I said before, I can't reproduce that behavior, using
^C^C-LAYER;SET;"ELEVATION";;-INSERT;"ELEVATION - MODEL";scale;1;rotate;0;
or
^C^C-LAYER;SET;"ELEVATION";;-INSERT;"STATION - MODEL";scale;1;rotate;0;

Just for testing purpose, try
^C^C_.-LAYER;SET;"ELEVATION";;_.-INSERT;"ELEVATION - MODEL";scale;1;rotate;0;

Henrique

EESignature

Message 10 of 17
ryled
in reply to: hmsilva

When you do use those macros do you achieve what you had shown in your picture?

 

I tried using that macro you had shown me for the two commands.

 

[ELE]^C^C_.-LAYER;SET;"ELEVATION";;_.-INSERT;"ELEVATION - MODEL";SCALE;1;ROTATE;0;
[STATI]^C^C_.-LAYER;SET;"STATION";;_.-INSERT;"STATION - MODEL";SCALE;1;ROTATE;0;

 

However I get the same  result shown below. 

  Annotative Pic 2.gif

Message 11 of 17
hmsilva
in reply to: ryled


@ryled wrote:

When you do use those macros do you achieve what you had shown in your picture?

  


Yes, the picture i had shown was made from blocks inserted with those macros, I did try in AutoCAD 2010/12/14, and always successfully.

I can't understand what is causing that behavior...

Hopefully, someone else can reproduce that behavior.

 

Henrique

EESignature

Message 12 of 17
ryled
in reply to: hmsilva

Maybe I have a system variable set different from what you do?  I'll look into that.  Thanks for your help Henrique, I appreciate it!

Message 13 of 17
hmsilva
in reply to: ryled

You're welcome, ryled.
Unfortunately, I couldn't give you much help...

Henrique

EESignature

Message 14 of 17
bhull1985
in reply to: hmsilva

Try using

(command "-insert" ..........)

for your macro, i.e. a lisp driven macro rather than the python or whatever std macros are.

Assuming you're using a full version of cad this should work just as well, being as you're having issues- perhaps even better.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 15 of 17
ryled
in reply to: bhull1985

bhull1985

 

For my macro I did use "-insert" (see below).  Unless you are referring to something else?

 

C^C^C-LAYER;SET;"ELEVATION";;^C^C^C-INSERT;"ELEVATION - MODEL";\

Message 16 of 17
ryled
in reply to: ryled

I found a solution by adding an ATTSYNC to the end of the macro.

 

 

[ELEVATION MARKER]^C^C^C-LAYER;SET;"ELEVATION";;^C^C^C-INSERT;"ELEVATION - MODEL";scale;1;rotate;0;\;;^C^C^CATTSYNC;NAME;"ELEVATION - MODEL";

 

Same concept for the station.

Message 17 of 17
hmsilva
in reply to: ryled

Glad you got a solution!

Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost