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

Get layout size, place block at calculated point

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
CAD_user85
1259 Views, 10 Replies

Get layout size, place block at calculated point

Dear autocad user, lisp users,

 

Will you please help me.

I would like to create a lisp that places a block at a pre-calculated point.

 

I've created a lisp that fetches me a block to place into my drawing. The only thing is

I have to point out the place i want it to go. I want it to got into the corner by it self.

 

I would like to create a lisp that calculates, by the retrieved variable of the layout / paperspace, minus 10

from the bottom right corner. minus 10 from the bottom up and from the right edge to the left.

 

It seem so easy when I write it... But Still No Luck

Please help me.

 

In advance, Thank you.

10 REPLIES 10
Message 2 of 11
hmsilva
in reply to: CAD_user85

weedseed85 wrote:
...
I would like to create a lisp that places a block at a pre-calculated point.
...
I would like to create a lisp that calculates, by the retrieved variable of the layout / paperspace, minus 10
...
It seem so easy when I write it... But Still No Luck
...

I understand that you want to create a lisp to insert a block in a specific point at the layout.
I do not understand what is the paper limit you want to grab, if you want to grab the plotting area or the entire sheet.
I don't understand, also, the location of the point relative to the previous area, try to define better the displacement
from the boundary area, if necessary attach an explanatory dwg.
And as you have written "It seem so easy when I write it"  post the code you have so far.
So maybe it is easier someone can help.


Henrique

EESignature

Message 3 of 11
CAD_user85
in reply to: hmsilva

Dear Henrique,

 

Thank your for your reply.

 

The limit, I think is, the edge of the paper. 

I've added a image that will explain my plot configurations better.

It also show the offset of the paper, for the block placement.

 

I hope that explains all your questions about the displacement.

 

Futher more, I don't really know all that much about LISP. I know

what i want. I just don't know how to write / create it.

Thus the line "It seem so easy when I write it" 

 

For this particulair question. I've not written anny lisp. I made use of autocad's actionrecorder.

 

I hope a answerd all of your questions.

If not, please ask.

 

Thank you verry much for your help.

 

Greets,

Michel 

Message 4 of 11
Kent1Cooper
in reply to: CAD_user85


@weedseed85 wrote:

....

I would like to create a lisp that places a block at a pre-calculated point.

....

I have to point out the place i want it to go. I want it to got into the corner by it self.

 

I would like to create a lisp that calculates, by the retrieved variable of the layout / paperspace, minus 10

from the bottom right corner. minus 10 from the bottom up and from the right edge to the left.

....


I assume the Block is to be at X & Y scale factors of 1 and a rotation of 0, and that the corner you're measuring from is the lower right of the paper-space limits, rather than of something like a border line in a title-block Xref.  The LIMMAX System Variable defines the upper right corner of the limits, and you can extract the separate components from that, as from any point list.  Try something like this [untested]:

 

(defun C:PlaceBlock () ; edit blue parts as desired

  (command

    "_.insert"

    "YourBlockName"

    (list ; insertion point

      (- (car (getvar 'limmax)) 10); X = 10 in from right

        ; (car (getvar 'limmax)) = X component of upper-right corner of limits

      10 ; Y = 10 up from bottom

      0 ; Z component [may not be needed]

    ); end list

    "" "" "" ; default scales & rotation

  ); end command

); end defun

Kent Cooper, AIA
Message 5 of 11
hmsilva
in reply to: CAD_user85

Michel,
after Kent's post, with quote, I realized the problem was mine, I misread your post, and I was reading (in my mind), an extra "10 from the top", therefore made no sense to me...I'm getting too old and I need new glasses 😄
Thankfully, Kent Cooper understood that correctly and wrote a code for you, that will be certainly always much better than one made by me.

 

Henrique

 

EESignature

Message 6 of 11
CAD_user85
in reply to: Kent1Cooper

Dear Kent Cooper,

 

Thank you verry mucht for that well explained lisp.

I will try and see what happens.

 

Thank you.

 

Greets Michel 

Message 7 of 11
CAD_user85
in reply to: hmsilva

Dear Henrique,

 

I occasionally miss read things as well. 

No matter.

 

Thank you for your reply.

 

Greets Michel

Message 8 of 11
CAD_user85
in reply to: Kent1Cooper

It works 😄 

 

It works perfectly.

The only thing I would like to do with it is, to 

_PASTCLIP a copied block.

 

For example,

I input a block into the MODELSPACE and COPY it from it's INSERTION POINT.

After copying I go to the LAYOUT / PSPACE.

Here I would really like to _PASTCLIP the block at the point your lisp is giving

 

Do you think that would be possible?

 

I look forward to your reaction.

 

Greets,

Michel

Message 9 of 11
Kent1Cooper
in reply to: CAD_user85


@weedseed85 wrote:

....

It works perfectly.

.... I would really like to _PASTCLIP the block at the point your lisp is giving

....


That works pretty much the same way as Insert, just without the Block name, or the scales or rotation [unless you call for them as options].  This should do it [untested]:

 

(defun C:PasteStuff () ; edit blue parts as desired

  (command

    "_.pasteclip"

    (list ; insertion point

      (- (car (getvar 'limmax)) 10); X = 10 in from right

      10 ; Y = 10 up from bottom

      0 ; Z component [may not be needed]

    ); end list

  ); end command

); end defun

Kent Cooper, AIA
Message 10 of 11
CAD_user85
in reply to: Kent1Cooper

It's perfect 😄

 

It's excactly the way I wanted.

 

 

Thank you verry, verry much for your help.

 

Greets,

Michel

Message 11 of 11
Kent1Cooper
in reply to: CAD_user85


@weedseed85 wrote:

It's perfect 😄

It's excactly the way I wanted.

Thank you verry, verry much for your help.

....


You're welcome [it's always a relief to hear back that something worked when I didn't test it!].

Kent Cooper, AIA

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

Post to forums  

Autodesk Design & Make Report

”Boost