Jayme McColgan Posted May 30, 2022 Share Posted May 30, 2022 is it possible to set the sheet layer size to the viewport i have on it? i can't seem to find any VS Functions on how to change the sheet layer sizing. Quote Link to comment
Jesse Cogswell Posted May 31, 2022 Share Posted May 31, 2022 (edited) @Jayme McColgan I think this should be totally possible. What you are looking for is SetDrawingRect. You could theoretically pull the bounding box size of the Viewport with GetBBox and use that to set the side of the page. The current page origin is stored as an application preference, so you'll want to get/set it using GetPrefReal(80) for the X value and GetPrefReal(81) for the y value. Also keep in mind that you may have to compensate for the user origin (all of the above commands will pull relative to the internal origin, which I have found many draftspeople do not properly respect). The user origin can be found with GetPrefReal(6702) for X and GetPrefReal(6703) for Y. This is the code that I had some success with (keeping in mind that this is Vectorscript instead of Python, but it's simple enough to translate): PROCEDURE SetPageToViewport; VAR viewHd:HANDLE; A,B:POINT; width,height:REAL; PROCEDURE GetSelectedVP(h:HANDLE); BEGIN viewHd:=h; END; BEGIN ForEachObject(GetSelectedVP,((SEL=TRUE) & (T=VIEWPORT))); GetBBox(viewHd,A.x,A.y,B.x,B.y); width:=B.x-A.x; height:=A.y-B.y; SetPrefReal(80,A.x+(width*0.5)); SetPrefReal(81,0-(A.y-(height*0.5))); SetDrawingRect(width,height); END; Run(SetPageToViewport); Edited May 31, 2022 by Jesse Cogswell 2 Quote Link to comment
Jayme McColgan Posted May 31, 2022 Author Share Posted May 31, 2022 thanks @Jesse Cogswell heres the python version for anyone looking in the future. import vs width = 2 height = 3.4 sheet_num = "BM-1" name = "Test Sheet Layer" def make_custom_sheet_layer(): curlayer = vs.CreateLayer(sheet_num, 2) ### Create Sheet Layer vs.SetObjectVariableString(curlayer, 159, name) ### Set Sheet Layer Name vs.SetDrawingRect(width*12, height) ### Set Sheet Layer Size return None 1 Quote Link to comment
Jayme McColgan Posted May 31, 2022 Author Share Posted May 31, 2022 13 hours ago, Jesse Cogswell said: @Jayme McColgan I think this should be totally possible. What you are looking for is SetDrawingRect. You could theoretically pull the bounding box size of the Viewport with GetBBox and use that to set the side of the page. The current page origin is stored as an application preference, so you'll want to get/set it using GetPrefReal(80) for the X value and GetPrefReal(81) for the y value. Also keep in mind that you may have to compensate for the user origin (all of the above commands will pull relative to the internal origin, which I have found many draftspeople do not properly respect). The user origin can be found with GetPrefReal(6702) for X and GetPrefReal(6703) for Y. This is the code that I had some success with (keeping in mind that this is Vectorscript instead of Python, but it's simple enough to translate): PROCEDURE SetPageToViewport; VAR viewHd:HANDLE; A,B:POINT; width,height:REAL; PROCEDURE GetSelectedVP(h:HANDLE); BEGIN viewHd:=h; END; BEGIN ForEachObject(GetSelectedVP,((SEL=TRUE) & (T=VIEWPORT))); GetBBox(viewHd,A.x,A.y,B.x,B.y); width:=B.x-A.x; height:=A.y-B.y; SetPrefReal(80,A.x+(width*0.5)); SetPrefReal(81,0-(A.y-(height*0.5))); SetDrawingRect(width,height); END; Run(SetPageToViewport); so whats else can i change in the "Edit Sheet Layer" Dialog box? can i go as deep as getting into the printer setup and creating custom page sizes? or changing the horizontal and vertical page amount? Quote Link to comment
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.