Jump to content

har

ConnectCAD
  • Posts

    32
  • Joined

  • Last visited

Posts posted by har

  1. Hi Marissa,

     

    thanks, that does clean things up quite a bit.

     

     

     

    AND it reminds me of another topic I had actually already crossed off as impossible:

     

    Say I generate a list using the GetFilesInFolder function - to find all jpg image files in a specific directory - and then pass that on to a popup that should also work. Or wont it?

     

    I'm going to try anyway but sadly I'm busy with other work the next few days....

  2. Hi,

     

    I haven't done this myself, but afaik a Texture - much like a Line Type or Hatch - will be referenced by an Index number rather than its name - Just to make things more complicated ;)

     

    http://developer.vectorworks.net/index.php/VS:Function_Reference_Appendix#tex

     

    Finding out the index value of your - I guess custom - texture will probably be a bit difficult.

    Dig through the VS function reference and you might find a way to get the texture from a referenced object/class.

     

     

    Personally, I've resorted to creating a Class for every "look" I want and just assign my objects to them accordingly.

     

  3. And while I'm at it, someone could help me clean up my code:

    ....
    type = Marionette.OIPControl( 'Panel Type', Marionette.WidgetType.Popup, 0, ['Blank','Vented','Security','Clamp'] )
    ....
    type = self.Params.type.value #This only returns an Index value of the selected Popup Option

    Is there any way to directly access the selected value, rather than only its index?

     

     

    For the nodes I'm doing, it doesn't make a huge difference. But it is kind of unnerving...

     

  4. On 23.9.2016 at 1:49 PM, Alan Woodwell said:

    Hi, am extremely new to Python, in your node is that a use of definitions and dictionaries? Its a lovely piece of work. Something to aspire to.

     

     

    Stop it, I'm blushing :) 

    I'm not using neither definitions nor dictionaries for this - way to high level.

     

    Python is actually a very easy-to-learn language - provided you understand some basic concepts of programming.

    It's probably a nice example to start from, so I've taken a few minutes to comment out my code - Something you should always do anyway!

     

    @Marionette.NodeDefinition
    class Params(metaclass = Marionette.OrderedClass):
    	this = Marionette.Node( 'Rack Panel Symbol' )
    	this.SetDescription( 'Creates a Rack Panel Symbol' )
    	#These create a Popup in the Node's OIP - Refer to: http://developer.vectorworks.net/index.php/Marionette_Implement_a_Node#Object_Info_Palette_-_Shape_Pane
    	type = Marionette.OIPControl( 'Panel Type', Marionette.WidgetType.Popup, 0, ['Blank','Vented','Security','Clamp'] )
    	ru = Marionette.OIPControl( 'RU Height', Marionette.WidgetType.Popup, 0, ['1','2','3','4'] )
    	
    def RunNode(self):
    	#All vs.XXX functions are "normal" Vectorscript functions.
    	#Refer to: http://developer.vectorworks.net/index.php/VS:Function_Reference
    	
    	#
    	#GLOBAL VARIABLES AND INPUTS
    	#
    	
    	typelst = ['Blank','Vented','Security','Clamp'] #Copy list of Popup options 1
    	rulst = ['1','2','3','4'] #Copy list of Popup options 2
    	oneRU = 44.45 #global measurement for one "Rack Unit" height in millimeters
    	rackwidth = 482.6 #global measurement for width of a 19" rack device in mm 
    	heightoffset = 4 #offset of drawn rectangles in Y
    	widthoffset = 14 #offset of drawn rectangles in X
    	
    	type = self.Params.type.value #This only returns an Index value of the selected Popup Option
    	ru = self.Params.ru.value #This only returns an Index value of the selected Popup Option
    	
    	name = 'Blank_'+rulst[ru] #Create string to find symbol
    	# (rulst[ru] is the "selectionth" (ru) index of the selection copy (rulst) -> Therefor, the value selected
    	
    	
    	#
    	#CREATION OF SYMBOL 'Blank_#'
    	#
    
    	vs.Symbol(name,0,0,0) #symbol instance based on "name" above - Refer to: http://developer.vectorworks.net/index.php/VS:Symbol
    	
    	#
    	#ATTACHING RECORD TO SYMBOL (to later find out how many of which type)
    	#
    	
    	handle = vs.LNewObj() #handle to symbol for next step
    	vs.SetRecord(handle, 'RackPanelRecord' ) #attach record to object
    	vs.SetRField(handle, 'RackPanelRecord', 'RUheight', rulst[ru]) #write to record field
    	vs.SetRField(handle, 'RackPanelRecord', 'Type', typelst[type]) #write to record field
    	
    	#
    	#MAKING DIFFERENT "TYPES"
    	#
    	
    	#if Popup Option "Type" is "Vented"
    	if typelst[type] == 'Vented': 
    		vs.Rect(widthoffset,heightoffset, rackwidth-widthoffset,float(rulst[ru])*oneRU-heightoffset) #Make a rectangle
    		handle = vs.LNewObj() #Handle to rectangle for next step
    		vs.SetClass(handle,'KW_racklayout-Panel-Vent') #assign rectangle to class
    	#if Popup Option "Type" is "Security"
    	elif typelst[type] == 'Security':
    		vs.Rect(widthoffset,heightoffset, rackwidth-widthoffset,float(rulst[ru])*oneRU-heightoffset) #Make a rectangle
    		handle = vs.LNewObj() #Handle to rectangle for next step
    		vs.SetClass(handle,'KW_racklayout-Panel-Secu') #assign rectangle to class
    	#if Popup Option "Type" is "Clamp"
    	elif typelst[type] == 'Clamp':
    		vs.Symbol(('ClampPnl_'+rulst[ru]),0,0,0) #Make a ClampPnl symbol
    		#There's only two version of Clamp Panels in the file (for 1 & 2 RU) as those are the only valid options. Error handling is ignored...
    		
    	vs.Group()
    	#Group it all together
    	#Not entirely neccessary (creates group in group) but I've made a habit of it as it makes some of my workflows easier.

     

     

     

    @MarissaF

    Thanks, please keep me updated.

    The proposed workflow is what I'm doing now. Problem is, I'm preparing this for all my colleagues and the poor bastards are just now switching to Vectorworks - They have enough other stuff to worry about ;)

  5. Hi all,

     

    I've just noticed a problem with one of my Marionette Object Nodes.

    It instances a symbol from the ressource browser and draws some rectangles based on user defined parameters.

     

    I've saved it as a Smart Symbol to my ressources.

    When double clicking it in the ressource browser to insert it, the first one works okay.

    Every further instance I create however, will be only the default symbol instance, no further Marionette functionality.

    Drag and Drop from the ressource browser works fine.

     

    I hope this makes sense, please refer to the file attached.

     

    What is causing this behaviour?

    Is there any way for me to fix this?

     

    Thanks in advance for any assistance!

     

    16-09-23_BlankPanelLibrary.vwx

  6. Hi Dom,

     

    thanks for you support.

    I maybe wasn't clear on my last post: My script is already done! It looks quite similar to your approach :) Anyway, as said I'm only linking to one specific file path in the document's directory.

     

  7. Hi Lee,

     

    I am an AV guy, this is the reason I'm using connectCAD.

     

    I know your task might sound very lightweight but it is in fact not all that easy.

    Creating an object with a defined number of connection points - That's the easy part.

    Then having a tool that will let you connect them to eachother - an SDK programming job.

    Having the lines follow you devices as you move them around on the drawing - an SDK programming job.

     

    The additional stuff that you might need - depending on your type of installations:

    - Rack Layouts

    - Metadata display

    - Output Device LIsts and Cable Lists

    - Cable Numbers

    - etc etc

     

    It's all doable - as the connectCAD team proves - but I wouldn't really recommend it as a first project!

     

    If you need this to work, I would still recommend investing in connectCAD.

    Apparently you already have VW, so the investment is even smaller than a more "lightweight" solution like Stardraw.

    I know, this sound like advertising, but I'm just really happy with the software.

     

     

    On the "does nothing node" approach:

    It will introduce complications for more complex schematics (no signal types, messy crossing lines, no links to different pages).

  8. Hi Alan,

     

    thanks for the support.

    I've gone down a little different route with this now:

    Instead of searching through a folder, there just needs to be a "ClientLogo.jpg" in the same directory as the document. Still better than what we used to do.

     

    Best

    Hannes

  9. Hi Alan,

     

    thanks for the quick example.

    Unfortunately, it's not a ideal option as I'm still having to edit my template anytime we have a new client.

     

    In the meantime I've found out how to create symbols from images in a folder by studying this example:

    http://developer.vectorworks.net/index.php/Python_Sample_Import_Images_as_Symbols

    So far, so good. Now I only need to have a method for selecting the correct symbol.

     

    Having the loop additionally create a list of all options is one line added to the code.

    However, populating a Pop-Up GPIO object with this list won't work as far as my research goes... I hope someone disagrees with me here ;)

     

  10. Hi all,

     

    I'm revisiting our Title Block at the moment. While I'm at it, I'd like to add a feature that we (similarly) used to have in AutoCAD:

    The Title Block comes with a field for the client logo - That naturally keeps changing.

    Right now, we're just dragging in JPEGs and manually scaling them - I'm not a big fan of that.

     

    The first option that comes to mind is the one I'm using for language options:

    Have every option in a different class and turn on/off the visibility accordingly.

    However, that just bloats up the template file and we have to adapt the template everytime we have a new client.

     

    I'd like to have a little Marionette Node that does the following for me:

    - Look Up a specific network folder

    - List all contained image files as options to chose from

    - Create a linked image based on the selection

    - Find the maximum in width/height and scale to fit the "frame"

     

    Is that doable?

    Any hints to VS functions I should check out for this?

     

    Thanks to all in advance!

  11. Hi Marissa,

     

    thanks a lot, that cleared it up.

    By using the 'sum' on both columns, I got exactly what I wanted - Counting all Panel objects that are the same.

     

    I've been trying to find some tutorials on worksheet scripting for a while now but didn't find anything useful.

    Any hints for places to start?

  12. Hi all,

     

    I can't find a proper subforum for my question, so I'm posting it here.

     

    As seen in the screenshot I'm doing the following:

    - Marionette Object will change its size and look according to user input via OIP (see 9 objects on shape pane)

        - The objects are "Rack Panel" used for 19" Rack assembly and have two parameters: "Rack Unit Height" (integer 1-4) & "Panel Type" (blank, vented, etc.)

    - The parameters are written into a database ("RackPanelRecord" (see exported .txt bottom right)

     

    However, when trying to generate a spreadsheet for that data, my approach doesn't seem to work (see bottom left).

    As seen on the drawing, there's three different versions of Panels with 1RU: "Blank", "Security" and "Vented"

    Instead of giving me three individual lines for each version, the spreadsheet will just "sum up" all 1 RU Panels and show "---" for the type field.

     

    What am I doing wrong?

     

    P.S.: I hope someone can make sense of what I wrote :)

    RackPanelDatabaseLink.JPG

  13. Hi all,

     

    I'm quite sure my question has already been answered as Google turned up some results - But redirecting to the new forum domain doesn't work, which is a bit frustating...

     

    Basically, I've written a Node that will create a few symbol instances and other objects based on Pop-Up OIPControl input.

    So far, so good.

    However, I need this node to be an Object Node for a proper workflow.

    Then again, the OIP Pop-Ups don't carry through to the Object Node's OIP which makes the whole thing nonsensical.

     

    - Do I have any possibilites to "expose" my OIPControl Pop-Ups to the "parent" Wrapper / Object Node?

     

    Thanks all for the input!

  14. Hi Lee,

     

    I've been using connecCAD for some time now. After the first few hours you will see how "simple" - in terms of usability - it really is.

    It's also very versatile and customizable and the connectCAD team is very helpful.

    If you can put in the investment, I'd recommend not reinventing the wheel.

     

    If you don't want to invest the money - and learn a lot by doing it yourself - Marionette (alone) is very probably not going to do the trick.

    You'll have to dig into Vectorscript and might even end up in SDK programming.

     

    Best

    Hannes

  15. Hi all,

    I'm trying to achieve the following:

    A custom object ("Device" from 3rd Party Plugin connectCAD) will be placed in a group together with my Marionette object node.

    (and some other objects).

    What the Marionette node should do then is the following:

    - find the object "Device" within that group (there's definitely only one)

    - read certain object parameters

    - instance a certain symbol based on that information

    Unfortunately, I don't know how to do any of these steps :)

    I couldn't find anything useful in the Marionette node or VS function reference.

    Maybe someone could point me in the right direction here?

    Thanks in advance for any info?

  16. Alright, seems there is no way to change the workspace after all. :(

    User accounts won't work for us. We're switching back and forth constantly and this needs to happen quickly. In the time I need to change my user, I adjust the settings myself.

    Also, we're on a managed network, IT wouldn't want to handle that just for our convenience.

    Just for future forum searches:

    This is the function reference for SetPref: http://developer.vectorworks.net/index.php/VS:SetPref

    SetPref is used for stuff that accepts boolean values.

    For anything else, you can use SetPrefReal, SetPrefInt, SetPrefString, etc.

    The selectors are in Appendix F: http://developer.vectorworks.net/index.php/VS:Function_Reference_Appendix#Appendix_F_-_Preference_Selectors

  17. Hi Hippocode,

    thanks for your answer.

    Also, sorry for my late reply.

    I dug a little deeper today and found the correct selectors for SetPref and SetPrefReal that I need.

    Really the only thing I haven't found is how to change the current workspace - Would you be able to point me in the right direction here?

  18. Hi all,

    I'm just barely getting started with Python in VW and have created some custom scripts for Marionette.

    Now, I face another task...

    Here's the story:

    We're using Vectorworks both in the Spotlight environment and with a 3rd Party plugin for other plan types (connectCAD).

    To properly work, these need different system settings (interactive settings - box sizes).

    I was hoping to create a script palette that would quickly switch between the two applications, doing the following:

    - change interactive settings

    - change active workspace

    - apply proper grid/snap settings

    I've looked in the VS function reference but I can't seem to find anything related to my task.

    Can I even access these settings from Python/VS?

    Thanks in advance for any answers!

  19. Hi Patrick,

    thanks a lot, that works for me.

    Also, greetings from Austria :)

    I deleted the GetItem node as I couldn't see any purpose and the network still works.

    Was there a specific reason for it?

    Aside from that, I'd still be interested why my script wouldn't work.

    Can anyone give some insight here?

  20. Hi all,

    not sure if this belongs here or on the Vectorscript board...

    I'm pretty new to Marionette and Vectorscript and have only limited experience with Python in general - Please be very slow with me ;)

    My task:

    Inputs are an array of strings and a string. I want to output an array of all indices in the array that match the input string.

    My code:

    @Marionette.NodeDefinition
    class Params(metaclass = Marionette.OrderedClass):
    this = Marionette.Node( 'Indices' )
    this.SetDescription ('Find all Indices in List that equal Item')
    this.SetListAbsorb()
    list = Marionette.PortIn( [] )
    list.SetDescription( "The input list" )
    item = Marionette.PortIn( None )
    item.SetDescription( "The item to be searched" )
    outlist = Marionette.PortOut()   
    outlist.SetDescription( "The result index list" )
    
    def RunNode(self):
    item = self.Params.item.value
    lst = self.Params.list.value
    
    outlist = [i for i, x in enumerate(lst) if x == item]
    
    self.Params.outlist.value = outlist

    My problem:

    the item value seems to be casted to a "wrong" type, resulting in no output. converting it with "str()" won't help either.

    As soon as I hardcode item to some string, the function will work as expected.

    What am I doing wrong here?

    Thanks a lot in advance for any answer!

×
×
  • Create New...