Jump to content

DomC

Member
  • Posts

    605
  • Joined

  • Last visited

Posts posted by DomC

  1. Hi

    I got a little script, which changes the dimension standard by the name of the dim standard. I did not fount a way to handle the dim-standard directly. I am just able, to get the dimension index and standard name from a dimension object. so my script draws temporary a dimension get the property. I got a Dictionary of DimStdNum and DImStdName at the end. So I could use this script, even the stacking order of the Standards is upside down.

    Now the Question:

    The very ugly piece of the script is, that i draw and delete objects just to have a relation between DimStdIndexNumber and DimName. Anyone know a direct way to handle to a Dimension Standard?

    #Python Code
    #At this place some code calculating,
    #which standard ist the right one for my design layer and for my Drawing scale.
    
    
    Choose_Standard='VSSM x0.1'
    Dim_Std = {} #Dictionary of  Name and Index Number
    i=0;v=''
    
    while v !=1:
    try:
    	vs.SetDimStd(i)
    except:
    	pass
    vs.LinearDim((0,0), (0,0), 0, 0, 0, 0, 0)
    h=vs.LNewObj()
    v=vs.GetObjectVariableInt(h,0) #if 1 the function switched to 1 because calling a outindexed standard an error
    n=vs.GetObjectVariableString(h,27)
    vs.DelObject(h)
    i=i-1
    if v !=1:
    	Dim_Std[n] = v
    
    vs.NameClass(c);
    vs.SetDimStd (Dim_Std.get(Choose_Standard));
    vs.SetPref(44,False);
    vs.SetTool(-210)
    

    Background Info:

    (To prevent questions like: "Why you would want to do that"):

    Out of the Box, Vectorworks just support one scale for one Design-Layer.

    I got a script here to change dim Standard and class to separate different Scales on one Design Layer. It also get the Layer scale of the active layer to choose the right standard for the intended scale in the Viewport. It would work without a much simpler script, if layer scale is set to 1:1. But that somehow hurts me to do that. And the Idea of a Routing-Layer-Scale ist not a bad one. But often there are small informations, which should be scaled in the right relation to the active layer scale.

    Annotation are no option (groups, import data, Symbols, PIOs, 3D Objects etc.). Main-Data, Information and Drawing has to be part of the (BIM)- Modell Space.

  2. It is possible to do this with a script call in in the Workseet.

    =RUNSCRIPT('Script-1', A4, B4)

    The Script (Make a new Script in the Ressource Browser Named "Script-1"

    Switch to Python Script):

    sym_name_old=vs.WSScript_GetPrmStr(0)
    sym_name_new=vs.WSScript_GetPrmStr(1)
    
    sym=vs.GetObject(sym_name_old)
    vs.SetName(sym, sym_name_new)
    
    vs.WSScript_SetResStr(sym_name_new)
    

    If you want to do this in a Symbol-List Worksheet. You can't write lines to that list. So you have to make a Record Format. Which you can edit in the List. And The Script will rename the Symbol with that Record Entry

  3. Hi Carl

    I made an example. Attached to this post. Hope, It can help you finish your project.

    Code in the Worksheet:

    =RUNSCRIPT('Script-1', A2, B2, C2, D2, E2)

    Code of the Script

    i=0;arg_len=1;args=[]
    while arg_len >0:
    arg = vs.WSScript_GetPrmStr(i)
    args.append(arg)
    arg_len = len(arg)
    i=i+1
    
    vs.WSScript_SetResStr(str(args))

  4. Hi

    I think, we have to specify the args in the worksheet scripts. Like this

    arg1=vs.WSScript_GetPrmReal(0)

    arg2=vs.WSScript_GetPrmReal(1)

    I tried to get all args with a while loop

    args=[];i=0

    while vs.WSScript_GetPrmReal(i) !=None: #Endless loop, attension!

    args.append(vs.WSScript_GetPrmReal(i))

    Don't try this. You will never be able to open your document again. Because Worksheets script automatically actualize at open document (which seems to be a nice feature ...) but If you have an endless loop in your script you will have to wait endless :-)

    Or maybe it's because the vs.WSScript_Get******* ist not very liberal, if you get wrong value type. A String instead of a float as example?

  5. Tim, you are right. Thanks for this good idea.

    There can be used search-tags, to find the requested nodes with cached index ( in real-time speed), very exciting ...!

    If we look at the left menu, there is a possibility to access the Vectorworks Service Select Content.

    But it will be still some work necessary from Vectorworks Inc. to collect, sort out, provide, put it on the server and manage this contents. I think local distributors could make this with their own content management.

    There is a good chance the pain of searching the community board for marionette ressources can have an end soon :-)

  6. Do you want get the output in your OS Terminal or somewhere out of Vectorworks?

    That is to high for me, but I am very interested on this possibilities too.

    As I suppose, that the args method is not loaded in an embedded python. So maybe we have to somehow initialize this first.

    But as I told, this could be a very dilettantish comment.

  7. And we all know, there always is a lake of girlpower (manpower). Someone had to copy/paste (I think this is allowed since the beginning of Software-engeneering :-), judge and coordinate the Node content. That costs time but it will be worth ...

    I just see, that we have a really potential tool and it has so much natural advantages compared to competitive software (It is totally integrated, no separate tool and acess to the complete BIM Objects and Record).

    Vectorworks you are in front! Just lap them for once.

  8. A Rectangle-Node, which has nearly the same capabilities like the rectangle tool users already know. Also it supports angle input and calculates edge-points to insert edge points.

    So many enhanced nodes are available here on the community-board. Will they find a way into the standard content anytime?

    This would save so much time for beginners and pros. who do not check daily the community-board.

  9. You can change the control geometry but if you paste a new one in you will need to name it and make sure it matches in the OIP. you will get an error until you have both the corresponding path names match.

    Nice, usefull example.

    But why you not just refer to the path directly?

  10. Great Marissa/Robert, thanks for update

    A (real-live) Example for this attached:

    1. A Truss (Just "stupid" crop a Truss Geometry by a length)

    2. Write the lenghts into a record field attached to the marionette object

    3. Creating a list of all "custom-lenght" trusses.

    Great product !

    Edit:

    For those who care about the truss:

    It's just a "control"-geometry with a 2m truss. And I just cut away the rest. So the limit for the truss is 1.999m. You can expand the control-geometry-truss to 20m as example and have an 19.999m truss ;)

  11. Hi

    Imagine you have client, which delivers you a room list. And a list, which objects have to be in this rooms. You can consider this lists with hundreds of rooms on your left screen and click them one by one in your rooms. You will make errors and your eyes will get squared.

    Another real interesting example how you could accelerate a routine job with a marionette script.

    Look here:

    P.S

    Sometimes I remember the good old times I turned on the radio-volume and drawed hatches with single lines one by one.

    • Like 1
  12. This Marionette Example, automatically place stake objects on every vertex point of all polys (parcel areas) on a specific class (input by any search criteria).

    Also the Marionette Script contains a custom node to filter double points. And a custom node to insert stake objects.

    This example has a potential for real application and also shows, how nice it is to control those stake pio's by a script.

     

    Bildschirmfoto_2016-05-19_um_17.05.25.png

    stake_objects.vwx

  13. Attached a Symbol Scale Node, which can do that. The Node has 4 knot Inputs for symbol, x, y, and z-scale.

    And another popup-input for scale type (None, Symmetric, Asymmetric)

    You could connect every object to this node. Just objects with type 15 (Symbol in Document) will be affected

     

    You can finde this Node on the "BIM Nodes" File posted in another topic.

    https://forum.vectorworks.net/index.php?/topic/47801-the-rest-of-domc-nodes/

     

  14. Hi

    For now the fastest way could be to keep your existing RandomSymbolNetwork alive and update the SymbolInFolder-Node with Version v02 . I extended the SymbolFoder Node as follows:

    A new Checkbox "IsFileFolder"

    If this Option is switched on, it takes all Symbols from a FileFolder in the Library/Defaults/MySymbolAreas/[Foldername.vwx] imports them and move them in a SymbolFolder (To not crash your ressource order ) with the same name.

    Maybe a future (easy) adaption could be, to always import the symbols in the same folder and delete the old symbols in the folder. So you can try out external content, without filling up your document ressources. reasonable?

    Cheers

    Dom

  15. Hi

    I think its just a problem of actualisation of the info-palette-view. The Objects change the class, but you do not see that immediately. To fix that, you could use

    "vs.ResetObject(h)" in the script

    Try this:

    c='Apt Construction'
    def DoIt(h):
    vs.SetClass(h, c)
    vs.ResetObject(h)
    return()
    
    criteria="(INSYMBOL & INOBJECT & INVIEWPORT & (SEL=TRUE))"
    vs.ForEachObject(DoIt, criteria)

    To unterstand the stript:

    1. c='class', just set c to 'class'. Instead of that we could use also vs.SetClass(h, 'class')

    To use there a variable is better, because maybe later you want to input that class name in a dialog box etc. So it is better "ask" for the variable valuesat the beginning of a script.

    I am thinking that maybe it should read

    c='None'

    def changeclass(Apt Construction):

    vs.SetClass(h, c)

    return()

    criteria="(INSYMBOL & INOBJECT & INVIEWPORT & (SEL=TRUE))"

    vs.ForEachObject(changeclass, criteria)

    not really, if you want to work whith an activated object. Your idea goes in a direction to put all objects in "None" to another class. (Which also could be realized)

    the function ( which starts with "def"), containes a callback function for ForEachObject (FEO). And FEO takes a handle to the object and input it in the function as "h". Your Class Name you do not have to input by "FEO", because you defined it at start with c='Apt Construction'

    FEO loops all objects by a criteria and "def" says, what to do with them.

    Above I renamed the function to "DoIt". This makes it more clear, what happens.

    All clear? :-)

  16. A node, which triangulates and creates a mesh or 3d poly lists from a regular (and sorted) point grid.

    Features:

    1. Solid mode "None" -> Creates a single area of triangulated areas

    2. Solid mode "Floor" -> Creates a solid mesh with plain base.

    3. Solid mode "Thickness" -> create an approximated (parallel) shell

    This node can draw a mesh and/or can return lists for further use.

  17. If it may be python:

    #python code
    c='class-1'
    def changeclass(h):
    vs.SetClass(h, c)
    return()
    
    vs.ForEachObjectInLayer(changeclass, 2, 1, 2)

    If you use this, check http://developer.vectorworks.net/index.php?title=VS:ForEachObjectInLayer

    for options

    Because "selectec object" could mean different things (all selected everywhere, just visible objects, etc.)

    You can use also:

    c='class-2'
    def changeclass(h):
    vs.SetClass(h, c)
    return()
    
    criteria="(INSYMBOL & INOBJECT & INVIEWPORT & (SEL=TRUE))"
    vs.ForEachObject(changeclass, criteria)

  18. Personally a big hope of me is, that the developpers have mercy and provide build-in functions to reshape.

    1. How fantastic it was, we could handle a "Reshape"cube (3D) or a Polygon (2D) and at least modify objects the same way like the 2D Reshape tool (The engine seems to be there, we just need that in Marionette or script commands)

    2. Even More fantastic if the tool (AND OR the function) could be setted up (An option level of how many times enter groups ) to go into containers (Extrudes etc) and modify as many geometry as possible.

    No constraints, no relations (no geniuses just a routine peace of work) would be necessary to realise such a powerfull and incomparable feature !!!

    OK, propably not as easy as that:-) .... but please

    • Like 1
  19. #python code. Copy this in your existing node. It just lists ALL Symbols without caring about symbol folders. Like always whithout warranty.

    @Marionette.NodeDefinition
    class Params(metaclass = Marionette.OrderedClass):
    this = Marionette.Node( "InsertAllSymDefinitions" )
    this.SetDescription( 'Shows all Symbol definition' )
    offset = Marionette.PortIn( (1), "offset" )
    offset.SetDescription( "offset of columns and rows" )
    columns = Marionette.PortIn( 4 ) 
    columns.SetDescription( "Number of columns" )
    angle = Marionette.PortIn( (0) )
    angle.SetDescription( "angle" )
    symbols = Marionette.PortOut()
    symbols.SetDescription( "the created symbol preview" )
    this.SetLinksObjects()
    
    def RunNode(self):
    
    versatz = self.Params.offset.value
    spalten = self.Params.columns.value
    angle = self.Params.angle.value
    
    x=0;y=0;zeile=0;c=1
    
    symnames=[]
    res_list,num_items=vs.BuildResourceList( 16, 0, '')
    
    for i in range(num_items):
    	res=vs.GetResourceFromList(res_list, i)
    	if res !=vs.Handle(0):
    		t=vs.GetType(res)
    		if t ==16:
    			symnames.append(vs.GetName(res))
    
    #vs.AlrtDialog(str(symnames))
    
    for n in symnames:
    	vs.Symbol(n,x,y,angle)
    	vs.Locus(x,y)
    	x=x+versatz
    	zeile=int(c/spalten)
    	y=zeile*versatz	
    	if c % spalten ==0:
    		x=0
    	c=c+1
    
    self.Params.symbols.value = vs.LNewObj()

×
×
  • Create New...