Jump to content

Recommended Posts

Posted (edited)

I've been working on a macro to insert a 2x4 fluorescent lighting fixture block with an editable attribute so that it will be 2' x 4' in model space and have a fixture designation attribute with text height defined at 0.125 times the dimscale value. And, when inserted into paper space, it will be .5" x .25" with text at 0.125" (the dimensions the block is drawn at). I thought the below macro would work -- and it does in paper space -- but it will not scale the block in model space by the appropriate factor (it scales it by "1" every time when it should be scaling the block by useri2=96). I'd greatly appreciate some help with making the following macro fully functional from a more experienced user.

 

^C^C_setvar;useri1;1;$m=$(if,$(!=,$(getvar,cvport),1),setvar;useri1;$(getvar,dimscale)_setvar;useri2;1;$m=$(if,$(!=,$(getvar,cvport),1),setvar;useri2;96;)-INSERT;2x4_r_cr;\"$m=$(getvar,useri2)";;\\-attedit  ;;;;L;A;0;H;"$m=$(*,0.125, $(getvar,useri1))";;

_setvar;useri1;1;

$m=$(if,$(!=,$(getvar,cvport),1),setvar;useri1;$(getvar,dimscale);)

_setvar;useri2;1;

$m=$(if,$(!=,$(getvar,cvport),1),setvar;useri2;96;)

-INSERT;2x4_r_cr;\"$m=$(getvar,useri2)";;\\

-attedit ;;;;L;A;0;H;"$m=$(*,0.125, $(getvar,useri1))";;

 

The bolded part above is where it seems to be breaking.

 

Thanks for any help!

Edited by Tsuwraith
* Edited to provide an analysis of my code for more transparent functionality *
Posted

I would do it in lisp then its easy to do a If or cond, model space v's paperspace.

 

1 question why insert block in paperspace when others are in model space ?

Posted

Tsuwraith,

 

Please read the CODE POSTING GUIDELINES and edit your post to include Code Tags (use the "Go Advanced" option, if not available in standard Edit Box), that will take care the Emoticon problem as well.

Posted

@BIGAL I could do this in lisp, but that isn't going to help me, as I need to make buttons for my team to use. They need the dual functionality of paper/model space insertion because my team works in both depending on the project.

 

@SLW210 Thanks. I've fixed my formatting.

 

I'd like to get my code functioning. What's really frustrating is that I feel it's written correctly, so I feel that I'm hitting a wall. After running the macro I can check the value of 'useri2' and it shows that it's been properly set to '96' in model space, but useri2 always inputs a value of '1' to scale the block. I don't know how to troubleshoot this further alone. I'd really appreciate someone's advice on how to tackle it, even if no one knows how to fix it specifically.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...