Jump to content
Kars Keizer

zoom and rendermode in script too fast/slow

Recommended Posts

Posted (edited)

I'm writing an Python script with this part in it:

vs.DoMenuTextByName('Standard Views',8)
vs.DoMenuTextByName('Fit To Objects', 0)
vs.SetLayerRenderMode(_hRenderlayer, 6, True, True)

Now i have the problem that the script gives the order to set the view and zoom and VectorWorks will do this , but when the script is ordering to set the rendermode VW is still busy setting the zoom and view and will skip this step.
 

If i run this script again without changing my zoom and view it will set the render mode correct because then VW can skip zoom and view and is ready when it gets the order to change the rendermode. I Think the issue is probably that VW is visually showing the zoom an view change and that takes time.

 

To set the rendermode first is not working because it will change back to wireframe when the zoom/view is changed.

 

I also tried the function vs.Wait() but this is not making any difference except the script takes longer to run.

Has someone an idea to overcome this?

Edited by Kars Keizer

Share this post


Link to post

Hello Kars (@Kars Keizer),

 

I'm not to sure this is related, but it is confusing. From the Script Reference Appendix I get:

 

1830877465_RenderSettings.thumb.png.06e8682899670742d3d175b10ade2876.png

 

and 6 appears to be "Final Shaded". When I run your script I get "Hidden Line", as read from the VW View>Rendering menu. I tried different constants and 5 gave me "Final Shaded Polygon", again as read from the VW View>Rendering menu. On a whim, try different constants. It may or may not work as it may also be platform dependent. I am on a MAC and you are on a PC. It's worth a try.

 

If you find the numbers are wrong, you may have found a bug in the documentation.

 

Raymond

 

Share this post


Link to post

@MullinRJ 

I see,

when I wrote the code i saw this comment in the remarks

afbeelding.thumb.png.f6682c5b88428980499203b6a24c8fa3.png

 

Following this remark i got this list of constants which i noticed were correct.

so the list in the appendix is not correct I think.

afbeelding.thumb.png.23f506b622646cb15fb9afce2919d76e.png

 

But this is not what is causing the problem.

Share this post


Link to post
Posted (edited)

Got what i wanted by first making an viewport and then exporting this viewport as an image,

By doing it this way i can use every render style and it will have no problems updating

The two time changing the render style and updating is because other wise the viewport will show an red cross. (don't no why but is working now)

_dLayername='Render'
_pLayername='Render2'
_dRenderlayer=vs.CreateLayer(_dLayername, 1)
_pLayername=vs.CreateLayer(_pLayername, 2)
_hViewport1=vs.CreateVP(_pLayername)
_nClass=vs.ActiveClass()
vs.SetObjectVariableInt(_hViewport1, 1001, 0)#Renderstyle can not be Wireframe
vs.SetVPLayerVisibility(_hViewport1, _dRenderlayer, 0)#set Layer visible in VP
vs.SetVPClassVisibility(_hViewport1, _nClass, 0)#set class visible in VP
vs.SetObjectVariableInt(_hViewport1, 1000, 0)#Orthogonaal
vs.SetObjectVariableInt(_hViewport1, 1007, 9)#view
vs.UpdateVP(_hViewport1)
vs.SetObjectVariableInt(_hViewport1, 1001, 11)#Renderstyle OpenGL
vs.UpdateVP(_hViewport1)
vs.Ungroup(vs.SymbolToGroup(_hViewport1, 0))
_hImage = vs.LSActLayer()
_ImageType = vs.GetObjectVariableLongInt(_hImage, 532)
if _ImageType == 1:
	ext = '.jpg'
else:
	ext = '.png'
_fileName = _RenderFolder +'\\' + _nSymbol + ext
vs.ExportImageFile(_hImage, _fileName)
_hlayer1=vs.FLayer()
_nlayer1=vs.GetLName(_hlayer1)
vs.Layer(_nlayer1)
_hRenderlayer=vs.GetLayerByName(_dLayername)
vs.DelObject(_hRenderlayer)	
_hRenderlayer=vs.GetLayerByName(_pLayername)
vs.DelObject(_hRenderlayer)	

 

Edited by Kars Keizer

Share this post


Link to post

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...