vernonlee Posted October 15, 2014 Share Posted October 15, 2014 (edited) One of my routine work is to highlight only part view of a drawing that has changes, to our consultants. This involves creating individual viewports, of a specific view, out of that drawing (which could have 1 or more viewports). I normally copy the existing viewport (no. of times will depend on the no. of views i need). Then i would pick 1corner of 1 of the copied vport & stretch it to the area concern, then stretch the other thereby resizing that copied vport to show a certain view of the drawing only. I then repeat this process depending on the no. of changes. If it would be possible, can someone advise on a lisp that can create the same viewport (using it as a base) (following the same UCS/layers that are on/off/frozen/thaw/lock/unlock) & with 3 clicks ( 1 click to select existing viewport, 2nd & 3rd click to create the 2 window corners for the new view port. That would shorten my work time considerably. Thanks Edited October 15, 2014 by vernonlee Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 15, 2014 Author Share Posted October 15, 2014 (edited) Attached is a picture explaining what i mean. Hope that would be clearer. Please also note the following:- - the viewport's view UCS is at an angle (meaning rotated) , as the drawing in modelspace is at an angle - all are existing drawings (created 2 years ago) Edited October 15, 2014 by vernonlee Quote Link to comment Share on other sites More sharing options...
David Bethel Posted October 15, 2014 Share Posted October 15, 2014 While you cannot use ( entmake ) or ( entmod ) on a viewport entity, you can access the data and xdata via ( entget ). This is a STARTING POINT ONLY ! [b][color=BLACK]([/color][/b]defun c:cvp [b][color=FUCHSIA]([/color][/b]/ en ss p1 p2 ed xd l1010 l1040 l1070 l1003 vtar vdir vtws vhgt vcxa vcya vlen vscl id[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setvar [color=#2f4f4f]"TILEMODE"[/color] 0[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.PSPACE"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]not en[b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]and [b][color=MAROON]([/color][/b]setq ss [b][color=GREEN]([/color][/b]ssget '[b][color=BLUE]([/color][/b][b][color=RED]([/color][/b]0 . [color=#2f4f4f]"VIEWPORT"[/color][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]= [b][color=GREEN]([/color][/b]sslength ss[b][color=GREEN])[/color][/b] 1[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss 0[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]initget 1[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq p1 [b][color=NAVY]([/color][/b]getpoint [color=#2f4f4f]"\n1st Corner: "[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]initget 1[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq p2 [b][color=NAVY]([/color][/b]getcorner p1 [color=#2f4f4f]"\nOpposite Corner: "[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq ed [b][color=NAVY]([/color][/b]entget en '[b][color=MAROON]([/color][/b][color=#2f4f4f]"ACAD"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq xd [b][color=NAVY]([/color][/b]cdr [b][color=MAROON]([/color][/b]cadr [b][color=GREEN]([/color][/b]assoc -3 ed[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq l1003 nil l1040 nil l1010 nil l1070 nil[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]foreach l xd [b][color=NAVY]([/color][/b]cond [b][color=MAROON]([/color][/b][b][color=GREEN]([/color][/b]= [b][color=BLUE]([/color][/b]car l[b][color=BLUE])[/color][/b] 1010[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]setq l1010 [b][color=BLUE]([/color][/b]cons [b][color=RED]([/color][/b]cdr l[b][color=RED])[/color][/b] l1010[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b][b][color=GREEN]([/color][/b]= [b][color=BLUE]([/color][/b]car l[b][color=BLUE])[/color][/b] 1040[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]setq l1040 [b][color=BLUE]([/color][/b]cons [b][color=RED]([/color][/b]cdr l[b][color=RED])[/color][/b] l1040[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b][b][color=GREEN]([/color][/b]= [b][color=BLUE]([/color][/b]car l[b][color=BLUE])[/color][/b] 1070[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]setq l1070 [b][color=BLUE]([/color][/b]cons [b][color=RED]([/color][/b]cdr l[b][color=RED])[/color][/b] l1070[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b][b][color=GREEN]([/color][/b]= [b][color=BLUE]([/color][/b]car l[b][color=BLUE])[/color][/b] 1003[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]setq l1003 [b][color=BLUE]([/color][/b]cons [b][color=RED]([/color][/b]cdr l[b][color=RED])[/color][/b] l1003[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq l1010 [b][color=NAVY]([/color][/b]reverse l1010[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq l1040 [b][color=NAVY]([/color][/b]reverse l1040[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq l1070 [b][color=NAVY]([/color][/b]reverse l1070[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq l1003 [b][color=NAVY]([/color][/b]reverse l1003[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [color=#8b4513];;;VIEW POINTS[/color] [b][color=FUCHSIA]([/color][/b]setq vtar [b][color=NAVY]([/color][/b]nth 0 l1010[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq vdir [b][color=NAVY]([/color][/b]nth 1 l1010[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq vtws [b][color=NAVY]([/color][/b]nth 0 l1040[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq vhgt [b][color=NAVY]([/color][/b]nth 1 l1040[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq vcxa [b][color=NAVY]([/color][/b]nth 2 l1040[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq vcya [b][color=NAVY]([/color][/b]nth 3 l1040[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq vlen [b][color=NAVY]([/color][/b]nth 4 l1040[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq vscl [b][color=NAVY]([/color][/b]/ vhgt [b][color=MAROON]([/color][/b]cdr [b][color=GREEN]([/color][/b]assoc 41 ed[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [color=#8b4513];;;MAKE A NEW VIEWPORT[/color] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.MVIEW"[/color] p1 p2[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq id [b][color=NAVY]([/color][/b]cdr [b][color=MAROON]([/color][/b]assoc 69 [b][color=GREEN]([/color][/b]entget [b][color=BLUE]([/color][/b]entlast[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [color=#8b4513];;;SET FREEZE LAYERS[/color] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.VPLAYER"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]foreach l l1003 [b][color=NAVY]([/color][/b]command [color=#2f4f4f]"_Freeze"[/color] l [color=#2f4f4f]"_Select"[/color] [color=#2f4f4f]"_Last"[/color] [color=#2f4f4f]""[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]""[/color][b][color=FUCHSIA])[/color][/b] [color=#8b4513];;;SET VIEW[/color] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.MSPACE"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.ZOOM"[/color] [color=#2f4f4f]"_C"[/color] [b][color=NAVY]([/color][/b]list vcxa vcya[b][color=NAVY])[/color][/b] vscl[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.VPOINT"[/color] vdir [color=#2f4f4f]""[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.DVIEW"[/color] [color=#2f4f4f]"_All"[/color] [color=#2f4f4f]""[/color] [color=#2f4f4f]"_TArget"[/color] vtar [color=#2f4f4f]""[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.PSPACE"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] Figuring out the view info and ucs would take some trail and error Can you post flow chart of all of the command sequences that you currently use ? -David Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 15, 2014 Author Share Posted October 15, 2014 Hi David Thanks for the reply. I just left office & on the way home when I saw your reply. Will try it tomorrow when I am back in office. I will also post all the command as requested. Thanks Quote Link to comment Share on other sites More sharing options...
David Bethel Posted October 15, 2014 Share Posted October 15, 2014 Now that I see you sample, I doubt that it is possible to automate that process. -David Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 16, 2014 Author Share Posted October 16, 2014 While you cannot use ( entmake ) or ( entmod ) on a viewport entity, you can access the data and xdata via ( entget ). This is a STARTING POINT ONLY ! Figuring out the view info and ucs would take some trail and error Can you post flow chart of all of the command sequences that you currently use ? -David Tried out the lisp. The steps & intention seems to be what i wanted (within 3 clicks) but the result of the newly created viewport is not the same view as the original viewport. Also, the view is showing the "Z" view. So i am seeing only 1 straight line This is the steps of how i normally do. Command: co COPYSelect objects: Specify opposite corner: 1 found Select objects: Current settings: Copy mode = Multiple Specify base point or [Displacement/mOde] : Specify second point or [Array] : Regenerating model. Specify second point or [Array/Exit/Undo] : *Cancel* Command: ** STRETCH ** Specify stretch point or [base point/Copy/Undo/eXit]: Command: ** STRETCH ** Specify stretch point or [base point/Copy/Undo/eXit]: Command: *Cancel* Basically each view i will need to create 3 viewports.1 for the drawing itself. 1 for the X axis grid line 1 for the Y axis grid line Hope to find a possible solution. Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 16, 2014 Author Share Posted October 16, 2014 Now that I see you sample, I doubt that it is possible to automate that process. -David Just to clarify, i do not mean 3 clicks to get 4 viewports out of that 1 existing viewport. More like 3 clicks to get 1 viewport would be out of this world for me. Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 16, 2014 Author Share Posted October 16, 2014 Alternatively, is there a way to match new viewports (excatly the same) to the original viewport? I tried that but the inside view is not in the same location & the drawing view was tilted Quote Link to comment Share on other sites More sharing options...
David Bethel Posted October 16, 2014 Share Posted October 16, 2014 (edited) This is totally (command ) grunt work, but maybe useful : [b][color=BLACK]([/color][/b]defun c:cvp [b][color=FUCHSIA]([/color][/b]/ oc oe en ss p1 p2 ed xd l1003 id vc oy vs vy vd[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq oc [b][color=NAVY]([/color][/b]getvar [color=#2f4f4f]"CMDECHO"[/color][b][color=NAVY])[/color][/b] oe [b][color=NAVY]([/color][/b]getvar [color=#2f4f4f]"EXPERT"[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.CMDECHO"[/color] 1[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.TILEMODE"[/color] 0[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.EXPERT"[/color] 5[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.PSPACE"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.MVIEW"[/color] [color=#2f4f4f]"_Lock"[/color] [color=#2f4f4f]"_Off"[/color] [color=#2f4f4f]"_All"[/color] [color=#2f4f4f]""[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]not en[b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]princ [color=#2f4f4f]"\nSelect Main Viewport"[/color][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]and [b][color=MAROON]([/color][/b]setq ss [b][color=GREEN]([/color][/b]ssget '[b][color=BLUE]([/color][/b][b][color=RED]([/color][/b]0 . [color=#2f4f4f]"VIEWPORT"[/color][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]= [b][color=GREEN]([/color][/b]sslength ss[b][color=GREEN])[/color][/b] 1[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss 0[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]initget 1[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq p1 [b][color=NAVY]([/color][/b]getpoint [color=#2f4f4f]"\n1st Corner: "[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]initget 1[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq p2 [b][color=NAVY]([/color][/b]getcorner p1 [color=#2f4f4f]"\nOpposite Corner: "[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq ed [b][color=NAVY]([/color][/b]entget en '[b][color=MAROON]([/color][/b][color=#2f4f4f]"ACAD"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq xd [b][color=NAVY]([/color][/b]cdr [b][color=MAROON]([/color][/b]cadr [b][color=GREEN]([/color][/b]assoc -3 ed[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq l1003 nil[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]foreach l xd [b][color=NAVY]([/color][/b]cond [b][color=MAROON]([/color][/b][b][color=GREEN]([/color][/b]= [b][color=BLUE]([/color][/b]car l[b][color=BLUE])[/color][/b] 1003[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]setq l1003 [b][color=BLUE]([/color][/b]cons [b][color=RED]([/color][/b]cdr l[b][color=RED])[/color][/b] l1003[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq id [b][color=NAVY]([/color][/b]cdr [b][color=MAROON]([/color][/b]assoc 69 ed[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.MSPACE"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.CVPORT"[/color] id[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.VIEW"[/color] [color=#2f4f4f]"_Save"[/color] [color=#2f4f4f]"CVP"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.UCS"[/color] [color=#2f4f4f]"_Save"[/color] [color=#2f4f4f]"CVP"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq vc [b][color=NAVY]([/color][/b]getvar [color=#2f4f4f]"VIEWCTR"[/color][b][color=NAVY])[/color][/b] oy [b][color=NAVY]([/color][/b]cdr [b][color=MAROON]([/color][/b]assoc 41 ed[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] vs [b][color=NAVY]([/color][/b]getvar [color=#2f4f4f]"VIEWSIZE"[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.PSPACE"[/color][b][color=FUCHSIA])[/color][/b] [color=#8b4513];;;MAKE A NEW VIEWPORT[/color] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.MVIEW"[/color] p1 p2 [color=#2f4f4f]"_.CHPROP"[/color] [b][color=NAVY]([/color][/b]entlast[b][color=NAVY])[/color][/b] [color=#2f4f4f]""[/color] [color=#2f4f4f]"_LA"[/color] [b][color=NAVY]([/color][/b]cdr [b][color=MAROON]([/color][/b]assoc 8 ed[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [color=#2f4f4f]"_C"[/color] [b][color=NAVY]([/color][/b]if [b][color=MAROON]([/color][/b]assoc 62 ed[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cdr [b][color=GREEN]([/color][/b]assoc 62 ed[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [color=#2f4f4f]"BYLAYER"[/color][b][color=NAVY])[/color][/b] [color=#2f4f4f]""[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq vd [b][color=NAVY]([/color][/b]entget [b][color=MAROON]([/color][/b]entlast[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] vy [b][color=NAVY]([/color][/b]cdr [b][color=MAROON]([/color][/b]assoc 41 vd[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] id [b][color=NAVY]([/color][/b]cdr [b][color=MAROON]([/color][/b]assoc 69 vd[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.VPLAYER"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]foreach l l1003 [b][color=NAVY]([/color][/b]command [color=#2f4f4f]"_Freeze"[/color] l [color=#2f4f4f]"_Select"[/color] [color=#2f4f4f]"_Last"[/color] [color=#2f4f4f]""[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]""[/color][b][color=FUCHSIA])[/color][/b] [color=#8b4513];;;SET VIEW & UCS[/color] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.MSPACE"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.CVPORT"[/color] id[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.VIEW"[/color] [color=#2f4f4f]"_Restore"[/color] [color=#2f4f4f]"CVP"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.UCS"[/color] [color=#2f4f4f]"_Restore"[/color] [color=#2f4f4f]"CVP"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.ZOOM"[/color] [color=#2f4f4f]"_C"[/color] vc [b][color=NAVY]([/color][/b]* vy [b][color=MAROON]([/color][/b]/ vs oy[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.PSPACE"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.EXPERT"[/color] oe[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.CMDECHO"[/color] oc[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] -David Edited October 21, 2014 by David Bethel Added More View Restoration - More & More Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 16, 2014 Author Share Posted October 16, 2014 This is mostly (command ) grunt work, but maybe useful : -David Hi David, I am still in office so tested it. the result was it matches the ucs (meaning the drawing is now right side up which is correct) however the scale & the view is different from the original. Quote Link to comment Share on other sites More sharing options...
David Bethel Posted October 17, 2014 Share Posted October 17, 2014 You can try the code in post #9 now. It should be closer. I still really don't see how you replicate your scenario in post 2. Good luck -David Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 17, 2014 Author Share Posted October 17, 2014 You can try the code in post #9 now. It should be closer. I still really don't see how you replicate your scenario in post 2. Good luck -David David. I just left office. Will see if I can try at home. Not sure if I got you correctly, but Regarding post 2, it was just to illustrate what I mean. From 1 viewport to 4 seperate ones at the same "model view location" but resized to view only 1 specific view each. Thanks for your effort Will post the results after I tried it. Thanks again Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 20, 2014 Author Share Posted October 20, 2014 H David, this is what i got from the updated LISP on post #9 Command: CVP_.PSPACE Already in paper space. Command: Select objects: 1 found Select objects: 1st Corner: Opposite Corner: _.MSPACE Command: _.CVPORT Enter new value for CVPORT : 3 Command: _.VIEW Command unavailable in view-locked viewport. Command: _Save Save drawing as : CVP A drawing with this name already exists. Do you want to replace it? _.UCS Yes or No, please. ; error: Function cancelled A drawing with this name already exists. Do you want to replace it? y Command: _.PSPACE Pressing Y or N resulted in nothing happening. . Hope you can probe further ,else I do understand & thanks for your effort. Quote Link to comment Share on other sites More sharing options...
David Bethel Posted October 20, 2014 Share Posted October 20, 2014 Command: _.VIEW Command unavailable in view-locked viewport. A locked viewport would lead to an error -David Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 20, 2014 Author Share Posted October 20, 2014 A locked viewport would lead to an error -David Will try again tomorrow. Thanks David Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 21, 2014 Author Share Posted October 21, 2014 Hi David. This is the results:- - Scale & UCS orientation is same. - Just that the location of the view is not. As show in the photo below Also, after running the command once, selecting the original viewport or any viewport (current or newly created) to create another viewport results in this:- Command: CVP_.PSPACE Already in paper space. Command: Select objects: 1 found Select objects: 1st Corner: Opposite Corner: _.MSPACE Command: _.CVPORT Enter new value for CVPORT : 2 Command: _.VIEW Enter an option [?/Delete/Orthographic/Restore/Save/sEttings/Window]: _Save Enter view name to save: CVP UCSVIEW = 1 UCS will be saved with view Command: _.UCS Current ucs name: *WORLD* Specify origin of UCS or [Face/NAmed/OBject/Previous/View/World/X/Y/Z/ZAxis] : _Save Enter name to save current UCS or [?]: CVP UCS "CVP" already exists. Replace it? _.PSPACE Yes or No, please. ; error: Function cancelled UCS "CVP" already exists. Replace it? y Command: _.PSPACE Selecting Y or N results in nothing happening Quote Link to comment Share on other sites More sharing options...
David Bethel Posted October 21, 2014 Share Posted October 21, 2014 Post #9 updated. Unless you have the named views saved, from what I've seen, I don't believe you could totally automate the view process. And even then I doubt the outcome will be exact. -David Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 21, 2014 Author Share Posted October 21, 2014 Post #9 updated. Unless you have the named views saved, from what I've seen, I don't believe you could totally automate the view process. And even then I doubt the outcome will be exact. -David Hi David Thanks. I have tried the updated lisp. It will now allow creating multiple view port without that error. The final issue is that the views still not the same. Buy It's ok. Perhaps it cannot be done. Thanks for the help so far. But I do hope someone out there can solve this issue Thanks. Quote Link to comment Share on other sites More sharing options...
David Bethel Posted October 22, 2014 Share Posted October 22, 2014 Can you post a sample ? Quote Link to comment Share on other sites More sharing options...
Stefan BMR Posted October 22, 2014 Share Posted October 22, 2014 I've made this one, using a different approach (vl-load-com) (defun C:CPVP (/ *error* acObj acDoc vp enti p1 p2 enti cen sc newcen dims) (setq acObj (vlax-get-acad-object) acdoc (vla-get-activedocument acObj) ) (vla-startundomark acDoc) (defun *error* (msg) (and msg (not (wcmatch (strcase msg) "*CANCEL*,*QUIT*,*BREAK*")) (princ (strcat "\nError: " msg)) ) (if (= 8 (logand (getvar 'undoctl) ) (vla-endundomark acDoc) ) (princ) ) (if (and (setq vp (ssget ":E:S:L" '((0 . "VIEWPORT")))) (setq p1 (getpoint "\nFirst corner: ")) (setq p2 (getcorner p1 "\nSecond corner: ")) ) (progn (setq p1 (trans p1 1 0) p2 (trans p2 1 0) enti (vla-copy (vlax-ename->vla-object (ssname vp 0))) sc (vla-get-CustomScale enti) newcen (mapcar '(lambda (a b) (/ (+ a b) 2.0)) p1 p2) dims (mapcar '- p2 p1) ) (if (= (vla-get-clipped enti) :vlax-true) (command "_clip" (vlax-vla-object->ename enti) "_d") ) (vla-update enti) (setq cen (vlax-get enti 'center)) (vla-put-mspace acdoc :vlax-true) (vla-put-activepviewport acdoc enti) (vla-zoomCenter acObj (vlax-3d-point (trans (trans newcen 3 2) 2 0)) 1) (vla-put-mspace acdoc :vlax-false) (vla-put-width enti (abs (car dims))) (vla-put-height enti (abs (cadr dims))) (vla-put-center enti (vlax-3d-point newcen)) (vla-put-CustomScale enti sc) (command "_move" (vlax-vla-object->ename enti) "" "_non" p1) (while (> (getvar 'cmdactive) 0) (command "\\") ) ) ) (*error* nil) (princ) ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.