Is there a lisp that would create multiple viewport by selecting multiple rectangle in model space with specified scale?
see attachment in order
hi there,
Unfortunately I haven't found yet the answer.
Still hoping that someone would step in to solve my problem.
Hi rulep21,
attach a sample dwg, with the before and after, and It should be easier to get some help.
Henrique
Hi Rulep21,
I'm with a very large workload, so, the following quickly written 'demo' is just a starting point for your code...
(defun c:demo (/ ctb i layout llpt ll llpt ss ur urpt) (if (= 1 (getvar "tilemode")) (if (= (length (layoutlist)) 1) (if (= (car (layoutlist)) "Layout1") (if (setq ss (ssget '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1)))) (progn (setq ctb (getvar 'CTAB)) (setvar 'CTAB "Layout1") (if (= 1 (getvar "cvport")) (command "_.MSPACE") ) (vla-getboundingbox (vlax-ename->vla-object (ssname ss (setq i (1- (sslength ss))))) 'll 'ur) (setq llpt (vlax-safearray->list ll) urpt (vlax-safearray->list ur) layt 1 ) (command "_.zoom" llpt urpt) (command "_.PSPACE") (repeat i (command "_.-layout" "_C" (getvar 'CTAB) (setq layout (strcat "Layout" (itoa (setq layt (1+ layt))))) ) (setvar 'CTAB layout) (vla-getboundingbox (vlax-ename->vla-object (ssname ss (setq i (1- i)))) 'll 'ur) (setq llpt (vlax-safearray->list ll) urpt (vlax-safearray->list ur) ) (command "_.MSPACE") (command "_.zoom" llpt urpt) (command "_.PSPACE") ) (setvar 'CTAB ctb) ) (princ "\n** You didn't select closed LwPolylines **") ) (princ "\n** Command only allowed with one Layout Tab named \"Layout1\" **") ) (princ "\n** Command only allowed with one Layout Tab **") ) (princ "\n** Command not allowed in Layout Tab **") ) (princ) )
Hope this helps,
Henrique
Hi Henrique,
Thanks for this one.
It works when the rectangle are on the same rotation.
What if they have different rotation?
I'm planning also to replace the rectangles with blocks (attributes) so that the layout name will match with the blocks.
see attachment below
@rulep21 wrote:
Hi Henrique,
Thanks for this one.
It works when the rectangle are on the same rotation.
What if they have different rotation?
I'm planning also to replace the rectangles with blocks (attributes) so that the layout name will match with the blocks.
You're welcome, rulep21
'It works when the rectangle are on the same rotation.'
Yes, your sample dwg only had rectangles with the same rotation... (And it was easier to write) 🙂
'What if they have different rotation?
I'm planning also to replace the rectangles with blocks (attributes) so that the layout name will match with the blocks.'
When we start to write a code, we have to know the final goal, in order to structure the code that way...
So, when we post a sample dwg, and if we want to be helped with the code we intend to write, it is advisable, to post a 'real' sample dwg.
As said in my previous post,
'I'm with a very large workload, so, the following quickly written 'demo' is just a starting point for your code...'
and without having seen these last drawings:
To use blocks with attributes with different rotation angles, probably you may continue to use the 'boundingbox', but you'll have to do a search for 'UCS boundingbox' function (I recall one from Gilles), to get the UCS BBox llpt and urpt for each block.
Pseudo code:
Hope this helps,
Henrique
Henrique
Hi, have you benn able to implement the block + attribute function ?
I'm really impressed and intersted to use your lisp.
Thanks.