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.
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
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
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
@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
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
Dear Kent Cooper,
Thank you verry mucht for that well explained lisp.
I will try and see what happens.
Thank you.
Greets Michel
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
@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
It's perfect 😄
It's excactly the way I wanted.
Thank you verry, verry much for your help.
Greets,
Michel
@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!].
Can't find what you're looking for? Ask the community or share your knowledge.