Jump to content

Kars Keizer

Member
  • Posts

    25
  • Joined

  • Last visited

Posts posted by Kars Keizer

  1. If you want to write the script using Python I can really recommand to read this document.
    Really helped me getting started.
    https://docs.python.org/3.8/tutorial/appetite.html

     

    if you start making scripts, in Vectorscript or Python this will be your most important reference.

    https://developer.vectorworks.net/index.php/VS:Function_Reference

     

    For making your script you can use for example Eclipse. I use this program as it was recommended to me by Peter.

    https://www.eclipse.org/

  2. al your types of dimensions will stay in their Dimensions (Maatlijnen) class because that is the only class they can exist in, this class you can not delete because of this reason.


    if I'm correct you want all your text placed in the text class? and because this class has its text style defined it will also changed the text to that style?
    you also don't want to change any dimensions and let them be as they are?

     

    Do you have an example file where you want to use your script? than i can test your script whit the presets you are using.

     

    you can also look at these functions to use in your script

    afbeelding.thumb.png.a40ec4c90d471c79777faf0b5a776d73.png

    https://developer.vectorworks.net/index.php/VS:Function_Reference#Objects_-_Text

     

    PS. Peter Vandewalle and I are both also Dutch speaking. (but I will continue in English so other people can also use this thread if we find the solution)

  3. the script sees the text in the measurements as text, but because measurements are supposed to be in the measurements class it conflicts I suppose.

    you could try adding C<>'Dimensions' (Class is not dimensions) in your criteria, this way it rules out all dimensions.

  4. I can not find a way to filter by IFC criteria. (not saying it is not possible), so in that way I can not help you.

     

    Is it maybe an idea to make an (simple) record and attach it to the components you want to filter later on? you can filter on having an record or on the text inside the record fields. just thinking along, I don't know if it fits your uses and drawingstyle.

     

  5. 8 hours ago, Pat Stanford said:

    Check your Snap Option. It is possible that you have Snap to Grid turned on and the end of the wall is trying to snap to the grid instead of being 90/180.

    or the snap to angle function is turned off.

  6. The way you made the worksheet now is the same way I would have done it, I foresee no problems.


    I can only find one thing that could have been the issue with the first file
    Did you update your Vectorworks between making the first and the second file?
    because in SP4 they fixed an bug with GetSpaceNumForObj.

    Quote

    VB-168111 GetSpaceNumForObj not working when space has no height

     

     

  7. Nevermind.

     

    I see the scripts is setting variables using vs. in the variable name. this confused me.

     

    the overall function is "VS:SetObjPropVS"  and the int. set to the variables are the parameters for this function

     

    learning constantly, this script is using OOP if I'm correct

  8. I found an script i wanted to use as an example for making my own Plug In Objects.

    This link is where i found the script:

    https://developer.vectorworks.net/index.php/Python_Sample_Point_Object_(complex)

     

    i installed the script and it is working but when i opened the script to see how it is working i noticed some functions which are not in the Function Reference
    https://developer.vectorworks.net/index.php/VS:Function_Reference

     

    Can someone tell me more about this? for example where i can find an description and parameters of these?

     

    the functions:

    vs.kObjXPropHasUIOverride   = 8
    vs.kObjXHasCustomWidgetVisibilities = 12
    
    vs.kParametricRecalculate   = 3
    vs.kObjOnInitXProperties    = 5
    vs.kObjOnWidgetPrep         = 41
    vs.kObjOnObjectUIButtonHit  = 35
    
    vs.kObjectEventHandled      = -8

     

  9. An script to find the object type number and name of the selected item, works also when placed in right mouse button menu.

    _hObject=vs.LSActLayer()#get handle of last selected object
    
    _tObject=vs.GetTypeN(_hObject)#get typeindex
    #_tObject=_hObject.type is also possible
    
    _list=["1","Line","Rectangle","Oval","Polygon","Arc","7","Freehand","3D Locus","Text","Group","12","Rounded rectangle","Bitmap Image","Symbol in document","Symbol definition","2D Locus","Worksheet","19","20","Polyline","PICT Image","23","Extrude","3D Polygon","26","27","28","Layer Link","30","Layer","32","33","Sweep	","35","36","37","Multiple extrude","39","Mesh","Mesh vertex","42","43","44","45","46","Record Definition (Format)","Record","Document script (1)","50","Script palette (1)","52","53","54","55","Worksheet container","57","58","59","60","61","62","Dimension","64","65","Hatch definition (1)","67","Wall","69","70","Column, Floor, Roof Face","72","73","74","75","76","77","78","79","80","Light","Roof edge","Roof object","CSG Solid (Addition,Subtraction)","85","Plug-in object","Roof element","88","Round walls","90","91","Symbol folder","Texture","Class definition (1)","Solid (Cone, Sphere, ...)","96","Texture Definition(Material)","98","99","100","101","102","103","104","105","106","107","108","109","110","NURBS Curve","112","NURBS Surface","114","115","116","117","118","Image Fill Definition (1)","Gradient Fill Definition (1)","Fill Space (1)","ViewPort"]
    
    vs.AlrtDialog('type no. :',_tObject,'\ntype name :',_list[_tObject-1]) # show type index and type name of selected object in an dialog

     

  10. I'm using vectorscript/python to make an list of all objects with an certain record and using information from this record.

     

    to eliminate human errors I'm starting the script with making the record so I'm certain all names and fields are correctly named.

     

    The thing that i can not get working at the moment is making an field in the record with an option module.

    so an field where you can not type but you have to choose between predefined options.

     

    does someone know if this is possible to create? when you make an record yourself in VW this is possible so why not with scripting

  11.   

    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 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)	

     

  12. 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)	

     

  13. I'm writing an script that will take each symbol(_i in list of symbols) from the resource folder makes an render and places it in an folder.

    for _i in _lSymbols:
    	_Renderlayer=vs.Layer('Render')
    	_hRenderlayer=vs.ActLayer()
    	vs.Symbol(_i,0,0,0)
    	vs.DoMenuTextByName('Standard Views',8)
    	vs.DoMenuTextByName('Fit To Objects', 0)
    	vs.SetLayerRenderMode(_hRenderlayer, 6, True, True)
    	vs.DoMenuTextByName('Copy',0)
    	vs.DeleteObjs()
    	vs.DoMenuTextByName('Paste As Picture',0)
    	_hImage=vs.LNewObj()
    	_iRenderFolder=_RenderFolder+ '\\' +_i+'.png'
    	vs.ExportImageFile(_hImage,_iRenderFolder)
    	vs.DeleteObjs()

    One problem i encountered is that when i set the render mode as "Final Quality Renderworks" (14) or "openGL" (11) it will produce an white square with "paste as picture".
    so whit this script I'm limited to using modes as "FinalHiddenLine"(6)

     

    Also my "vs.ExportImageFile" is not working at the moment.

     

     

    Can Anyone give some tip ore advise on this script or how the get an similar result using other functions.
    I also looked into using vs.DoMenuTextByName('Export Image File') but this wil give an dialog for the user and I'm trying to limit/eliminate all user interaction.

     

     

    See also my other topic on an small part of this script

     

  14. 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?

  15. Hope I'm not trying something to difficult,
    Started with marionette an few months ago, but I'm an fast learner with experience in multiple CAD programs.
    (could work with VW without problems within an month)

  16. I'm trying to manage the shared recourse manager at my company.

    In the library and on the internet I can hardly find nodes to interact with the recourse manager instead of the design layer.
    For example whit "objs by crit" I can only select symbols that are place in the design layer.
    Am i missing something or does someone has nodes i can use.

    What I'm planning to do:

    with the programme we use for managing our stock we can get an excel file with art. numbers, description, amounts and dimensions.
    when we make an new article/symbol and we place it in the resource manager, I want to make an script that checks the name of the symbol

    (which we will give manually by using the article number)

    When it recognises the symbol name(Art. number) it wil changes its name in art. number+description.
    also the extra information will be put in an record attached to the symbol.

    Problems(challenges) I'm facing so far:
    obj name and symbol name are different things. missing a node to get symbol name.
    attaching record is only attaching it to the symbol as object and not to the symbol itself, so when i put information in the record it doesn't change copies of this symbol.

    A node of some kind to get an list of symbols in the resource manager.
    No node of some kind to change a symbol name.

     

    I already started rewrite code's of some nodes to make them do what i want, but still learning and not much experience with python.

×
×
  • Create New...