mrharris78 发表于 2022-7-6 07:28:03

Viewport UCS, Zoom Object

I have a 'Snake' of rectangles which represent viewport views, each has its own UCS and its own layer. I am attempting to write some code which does the following;
 

(defun c:sheet1 (/ SS1 )(command "setvar" "ucsfollow" "1")(setq SS1 (ssget "x" '((0 . "LINE")(8 . "SHEET1"))))(command "_.UCS" "_ENTITY" SS1)(command "_.PLAN" "")(command "_.UCS" "Named" "Save" "Sheet1"))
 
and the next one, and so on..
 
There is a problem, when I zoom 'object', it zooms to the extents of the rectangle in WCS and not the extents of the rectangle in the current UCS.
 
This should be easy, Or maybe I am going the wrong way about it....
 
Any help would be much appreciated.
 
Cheers
 
H

marko_ribar 发表于 2022-7-6 07:51:54

SS1 is selection set of LINE objects residing in layer SHEET1... So when used UCS "entity", you have to specify single entity, not a SS1... Maybe, if you only have 1 rectangle in SHEET1, you'll just need (command "_.UCS" "_Entity" (ssname SS1 0)) supplying last entity from SS1, otherwise CAD won't know on what entity should UCS have to be aligned to... Afterward, you don't need (command "_.PLAN" "") as you set variable 'UCSFOLLOW to 1, but you'll probably need to zoom it again to that particular object - rectangle - use : (command "_.ZOOM" "o" (ssname SS1 0))
 
M.R.

SLW210 发表于 2022-7-6 08:18:23

Please read the CODE POSTING GUIDELINES and edit your post.

mrharris78 发表于 2022-7-6 08:30:50

Posted Edited - My apologies SLW210
 
Marko, Thanks for your input/advice. I amended my code to suit, just playing around now to make it zoom to the extents of the object..
页: [1]
查看完整版本: Viewport UCS, Zoom Object