Jump to content

Macro to copy modelspace object down by known paperspace distance


Recommended Posts

I have toyed with a few options, but cannot seem to find one that will work.

 

Trying to copy a text object down by 3.5 paperspace units.

 

I have been trying variations of saving the distance as an environment variable, but then the copy command will not allow the syntax for returning that value.

Command: COPY

1 found

Current settings: Copy mode = Multiple

Specify base point or [Displacement/mOde]
: d

Specify displacement :

Above is what the command line ought to look like at 1:100. But then it needs to say -0.7 (instead of -0.35) at 1:200 and so on.

 

So I thought something like this might work:

Copy;Displacement;0,('spacetrans;-3.5),0;;

But it returns

Point or option keyword required.

I have tried the same with 'CAL expressions. This would be something like

Copy;'cal;'spacetrans;3.5;<180;

more simply, I am trying to return 0.35

which will move it a distance of 0.35 at an angle of 180 degrees.

 

 

Is there another way I can tackle this? The only difficult part is 'spacetrans, or some way of copying at a different height depending on the viewport scale.

Link to comment
Share on other sites

I probably should have put "variable paperspace y-axis distance" in the title.

 

More simply, is possible to return a DIESEL variable as either a vector or a displacement in the copy or move commands?

Link to comment
Share on other sites

Do you mean something like this, it needs you to have selected the objects first within an active paperspace viewport (though you could adapt the macro to allow user selection), it then copies those objects -3.5 paperspace units, it should work for whatever scale the viewport currently has.

^C^C^Ccopy;0,0;0,$M=$(/,-3.5,$(getvar,cannoscalevalue));

Link to comment
Share on other sites

That's it! I got to admit though, I don't even understand how it works! Haha.

 

Oh wait, I got it now, so it returns (-3.5/cannoscalevalue) as the change in y axis.

 

Nice. I have tried many times for many different applications to process a DIESEL expression inside of a command expecting coordinates and have never been able to get a single one to work. Made me wonder if my syntax was incorrect or if it was simply not possible.

 

Solid work as always steven-g.

Link to comment
Share on other sites

The -3.5 is the value that you gave (obviously), the variable cannoscalevalue reflects the value selected in the viewport scale box, which also controls the annotation scale, this only works if you have the scale value picked (if you are zooming in and out of a viewport then the value will not be correct). I wish I could claim to know all this stuff, but to be honest I just spotted that this value changed when you change the viewport scale, the rest was just fudging untill something worked. :huh:

 

This doesn't actually work with coordinates, it just works out a single value and assigns it to the Y axis, working with coordinates is a bit different (and requires more fudging)

Link to comment
Share on other sites

Yeah, we always work in lock viewports with cannoscale set correctly (using a button macro of course), so I have already tested and your solution works at any of our drawing scales.

 

The final macro for your interest is:

^C^CUCS;View;Copy;Previous;;0,0;0,$M=$(/,-3.5,$(getvar,cannoscalevalue));

 

It is the second in a series (the first one picks thems into the selection set then leaves them for user to edit text).

Link to comment
Share on other sites

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...