Jump to content

Will

Member
  • Posts

    159
  • Joined

  • Last visited

Posts posted by Will

  1. I am developing a PIO, but I’m encountering what seems to be a bug in the plug-in definition.

    The PIO is defined like this:

    [img:center]https://dl.dropboxusercontent.com/u/2804259/Files%20shared%20for%20conversations/2015.05.29/PastedGraphic-3.png[/img]

    With these properties:

    [img:center]https://dl.dropboxusercontent.com/u/2804259/Files%20shared%20for%20conversations/2015.05.29/PastedGraphic-2.png[/img]

    Note that in the screen shot above “Requires 3D” is set, but it does not appear to be possible to draw the path which defines the PIO on any other plane apart from the layer plane and if I try to rotate to another plane after drawing I get this error:

    [img:center]https://dl.dropboxusercontent.com/u/2804259/Files%20shared%20for%20conversations/2015.05.29/PastedGraphic-1.png[/img]

    I have the same problem if I create the plugin as a point object. |t doesn’t seem logical that you can set "Requires 3D” but it is only possible to draw something on the layer plane. I would expect a 2D path based PIO to be able to draw on any arbitrary working plane as the normal 2d path tool can.

    Thanks for any insight anyone can give on this.

  2. Just got around to trying this and it works. This answer helped a lot, thanks.

    By the way for anyone else out there having problems, note that if you use this technique any mistakes you make in importing modules can show up as pretty obscure errors. I had a problem where I was missing an __init__.py and the error thrown was completely unrelated.

  3. I would like to be able to set up a load of drawing sheets with drawing borders, logos etc all inserted. Save the file as a stationary file in the workgroup default content folder and then use them to create new drawings with borders all set up and ready to go from the "new sheet layer" option in the layers drop down menu. Currently only the page setup is imported, not the items drawn on the sheet layer.

    • Like 1
  4. Classes should be more like tags in the mac finder (as of OS X Mavericks). You can apply multiple tags to things. When you use a 'wall' tool the thing gets tagged as (wall), same with roof tool (roof).

    But as all these objects are actually the same, the connect/combine tool, the push pull tool, the reshape tool all work consistently on them.

    Edit 2: Heres what tags look like in OSX finder:

    Screen%20Shot%202014-09-25%20at%2015.32.35.png

    Your classes (tags) palette has a search bar and you can save a search which is then acted on to show hide or grey stuff. E.g. '(Hide^) all tagged (wall) + (roof) + (door handle)' where (Hide^) is a little 'pill' with drop down menu that allows you to select from show/hide/grey. 'pills' for class names autocomplete when you type them so they are easy to find, just like finder tags in OS X Mavericks.

    While you are drawing tags are assigned the same way as classes are now. E.g you would have (Services)+(Electrical)+(HV line) selected as your current tags and whatever you are drawing would be tagged with all of these. Some tag names are reserved by vectorworks and are always applied when you use specific tools. E.g. (wall) (roof) (slab)

    Then, for example, if you want to see all the services but nothing else. You could have this active in your classes pallet:

    (Show^) all tagged (Services)

    Or if you want to find all the roofs for a worksheet its the same interface to set up the search E.g. (Show) all tagged (Roof).

    You could also have an option to automatically create a list of all the tags with a show hide option so it wouldn't look too different to how it is now for the old timers who hate change.

    Edit: Just in case anyone is wondering what I mean by pill:

    Screen%20Shot%202014-09-25%20at%2015.01.51.png

  5. Why are walls roofs and slabs all different kinds of objects with different tools for cutting holes and inserting symbols? Conceptually they can all be defined by a shape on a plane which is extruded and offset a couple of times to form a wall out of a series of layers. Just have one thing, call it a composite linear object or something. Then we wouldn't have to wait for you to update the roof object with features that the wall tool has had for years. :-)

  6. Thanks for replying. None is the python language 'null object' so I'm guessing its equivalent to NIL but I'm not sure as it's not really documented anywhere, so far as I can tell. The vector script example on the page for CreateCustomObjectPath shows NIL as the argument for this function, I'm not sure what a renderworks camera would use a profile group for is so I'm guessing I don't need one but don't know for sure.

    I'll try setting various fields using SetRField. I'm not sure what fields I can set that will help with the zero length camera object though.

    I'll also try the same script in vector script and see what happens.

    Thanks

    W

  7. Hi All,

    I'm trying to create a Renderworks Camera from script like this:

    pos = (0,0,0)
    ang = 45
    vs.MoveTo(pos)
    v = vs.Ang2Vec(ang, 1000000)
    vs.LineTo( pos[0]+v[0], pos[1]+v[1] )
    path = vs.LNewObj()
    cam = vs.CreateCustomObjectPath( "Renderworks Camera", path, None)
    

    But I get this error:

    Error on line=1: _313 _60 - The object described has zero size. It cannot be created
    Error on line=1: _218 _224 - Error trying to convert string to number.
    

    And then a camera is created which appears to be based on a line length of 0 and has various problems when I try to use it.

    Can anyone see what I'm doing wrong? Is a line the wrong kind of path to use for creating a linear object? Should I be using CreateCustomObjectPath or CreateCustomObjectN, both have similar errors?

    Thanks for any help

    Will

  8. Does anyone know what a valid mask is for GetFileN?

    By trial and error I have discovered that "*.JPG" is valid but this is case sensitive and so it doesn't allow selecting .jpg files. Is there any way to have more than one file extension? I was guessing something like shell globbing "*.{JPG,jpg}" or regexp "[JPG|jpg]" would work but they don't.

    Any ideas?

    Thanks

    Will

  9. I don't call print() in the code executed through vectorworks, only in the interactive shell in my terminal which am a using to demonstrate that the python code is correct and has works as intended when called by the official python 3.3 interpreter. It wouldn't make any difference if was calling vs.Message() or print() from the script executed in vectorworks because it barfs on the import statement before it has had a chance to get that far.

    I can import single files individually, but I want to nest one module inside another and this doesn't work. Have you tried importing a module which imports another module?

    I'm on OS 10.9 Are you running on windows or a different OS X?

  10. I think I found a bug in the Vectorworks implementation of the python interpreter which prevents it loading packages correctly.

    To reproduce:

    You should have a directory structure that looks like this:

    ~/vspython/
                     pytest/
                               __init__.py
                               sub/
                                     __init__.py
                                     a.py
                                     b.py
    

    The contents of file a.py should be:

    import sys
    import pytest.sub.b
    
    def callFinB():
       return pytest.sub.b.syspath()
    

    The contents of file b.py should be:

    import sys
    
    def syspath():
       return("Message from b")
    

    In a blank file create a new script palette

    Create a new script in the script palette and set the language to python.

    Click the scripting options button and add the ~/vspython directory to the python path

    Paste the following into the script:

    from pytest.sub import b
    from pytest.sub import a
    a.callFinB()
    

    Click OK to close the script window to save. Double click the script in the script palette to execute it. I get an error. However, in an interactive python3 session I get the expected results as you can see here:

    Bonobo:CAD scripts will$ python3
    Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 16 2013, 23:39:35) 
    [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from pytest.sub import b
    >>> from pytest.sub import a
    >>> print(a.callFinB())
    Message from b
    >>> 
    

    The only workaround I can find is to put the entire contents of the script in one file and only import this.

  11. Yes, thats what I thought at first but it has no trouble finding the vs module when its imported from __init__.py so this can't be the problem. It might be some subtlety of how the python imports modules but I have done extensive googling and I can't find a problem which is the same as this, some very similar but not this exact problem with importing an external module twice....

  12. OK so I'm writing a pretty complicated script and I don't want it all in one file.

    I have a whole bunch of functions which are very simple and just wrap the original vs function. I want to put these in a file called wrappers.py. Like this:

    import vs
    import vso.base
    import vso
    
    def angToVec(angle, distance):
       v = vs.Ang2Vec(angle, distance)
       return Pt( v[0], v[1] )
       pass
    
    def penLoc():
       p = vs.PenLoc()
       return Pt( p[0], p[1] )
       pass
    
    def moveTo(pt):
       vs.MoveTo(pt.xy())
       pass
    
    def lineTo(pt):
       vs.LineTo(pt.xy())
       pass
    

    The directory structure of my package looks like this:

    vso/
       __init__py
       base.py
       wrappers.py
    

    To test this I have a script in a script palette in vector works which contains simply

    import vso

    If the above functions are in __init__.py, they work. If I paste them into wrappers.py and import them into __init__.py like this

    for wrappers import * 

    I get the error

    Traceback (most recent call last):
      File "", line 4, in 
      File "/Users/will/vso/__init__.py, line 75, in polar
            v = angToVec(ang, dist)
      File "/Users/will/vso/wrappers.py", line 5, in angToVec
    NameError: global name vs is not defined.

    Even though, as you can see from the contents of my wrappers.py file above, I am clearly importing the vs module.

    Python definitely allows importing the same module into multiple files. Is there some limitation in the Vectorworks implementation where I can only use import vs once per script?

    Any other clues about whats going on here? This (and python modules in general) is driving me slightly mad... I wish you had chosen Ruby, its much cuter... :.-(

×
×
  • Create New...