Jump to content

Musisback

Member
  • Posts

    154
  • Joined

  • Last visited

Posts posted by Musisback

  1. Hello,

    I am looking for an equivalent in the SDK of the vectorscript function OffsetPoly that works on 2D polylines.

    VS:OffsetPoly works on polygones and polylines just as the offset tool : image.thumb.png.ec7d7d99e3bcf901d2f5ab073b3bce4d.png but can be used in plugin objects.

     

    I tried GetOffsetRingPoly of the VWPolygon2D class but it return a polygone, not a polyline.

     

    Any ideas ?
     

     

     

  2. Well, it works, but it is quite tricky because the duplicate doesn't have a name after duplication...

    Here's how I do :

    function duplicateClass(className : string) : string;
    Const 
       ProvName = '###NewClass###';
    VAR
       newClass, class2duplicate :  handle;
    
    BEGIN
       class2duplicate := Getobject(className);
       newClass := CreateDuplicateObject( class2duplicate,getparent(class2duplicate));
       SetName(newclass,ProvName);
       RenameClass(ProvName ,className);
       duplicateClass := Getname(newClass);  
    END;
    

  3. Hello,

    I use external packages in python. I'm wondering what's the best way to distribute them to the plug-ins users. It's apparently bad to place them in the plug-ins folder because Vectorworks goes through all the subfolders of "Plug-ins" at startup looking for plug-ins files

    I think I could create a Python folder in the user application folder.

    Do you think it can be damaging to the application to have an extra folder full of subfolders in the user's application folder (next to Plug-ins, Libraries, Workspaces, ...) ?

    Do you have better ways to distribute external python packages ?

    Thank you,

    Regards,

  4. Hello,

    The python interpreter of Vectorworks automatically generates .pyc files in a __pycache__ folder. It does it if the plugin is encrypted (obfuscated) or if it's not.

    On the other hand, it seems quite easy to uncompile .pyc files :

    http://stackoverflow.com/questions/5287253/is-it-possible-to-decompile-a-compiled-pyc-file-into-a-py-file)

    Does that mean that it is not possible to properly protect our source code?

    Wouldn't that be easier to simply distribute the .pyc instead of the encrypted vso/vst/vsm file ?

    Common .py files would not need to be packed up in each plugin file and the plugins would therefore be lighter...

  5. I use a different approach to solve this issue.

    I created a command that clears all the modules in a designated folder. (In the example : myLibrary)

    It actually removes the modules from sys.modules. Python will therefor import them again at the next import statement. I find this much easier than placing "reload(module)" statements everywhere in my code. (especially since they need to be removed for deployment)

    import sys
    modulesToDelete = []
    for m in sys.modules:
       moduleName = str(m)
       if "myLibrary."  in moduleName:
           modulesToDelete.append(moduleName)
    currentModule = __name__
    for mod in modulesToDelete:
       if mod != currentModule: # Python cannot delete the current module
           del sys.modules[mod]
    

  6. Hello,

    I use resources from an external file in a PIO dialog thumbnails popup control. ( ex : wooden panels textures). I don?t want other texture ( from the current file but not from the external file) to appear on top of the list. I could erase some textures but I cannot make the difference between the resources that are in my current file and also in the external file (previously imported) and the resource that are in my current file but not in my external file.

    Any Idea ?

    Damien

  7. Hello,

    Is it possible to build a resource list with only a part of the symbol definitions of the external file. (For instance, only one symbol folder.) I actually want some symbols to appear in my dialog box but not all of them. I cannot move the others in another file because they are sub-parts of the main symbols.

    VectorScript Function Reference says for VS:BuildResourceList:

    It also will not work on any symbol which is inside a folder -- it only works on symbols at the top level.

    But it doesn't seem to be true. All symbols appears for me.

    Thanks,

  8. Hello, I use external resources in my PIO's. (texture's, records format & symbols)

    To make the PIO's works better, I only import them when they are missing from the current file.

    What I would like to do, is checking if the resource in the external resource file is the same that the one it the current file.

    This way, I could reimport out of date resources in projects that were started long ago when the resources where different.

    VW checks if the external resource is the same as the local one all the time.

    For example :

    -if you import a external symbol, it will display the "replace resource dialog" only in there is a difference between the local and external symbol.

    - in a resource popup window (e.g. textures popup) the resource is only displayed twice if the local and the external version are not the same...

    In short : How to do this check myself?

  9. I have a new version of my PIO's and some default parameters have changed.

    The default parameters are set in the template my users use.

    So with the update of the plug-ins I am going to distribute a new template.

    The problem is that some older files might produce weird results with the new plug-ins.

    So I'm thinking of doing an update script to set the new default in older files.

    I could 'hard code' the default in my script, but I would prefer to be able to read the real default parameters. (the ones set in the plug-ins editor, not the default in the current file.)

  10. At this point, I have to draw this object 2 times for each room, which won't change when I manage to get them connected, but at least the data on the space object can be shared easily.

    If it is about sharing data, then the easiest way might be to just share data.

    Let me explain :

    You can give a name to your Master object.

    
    if  getname(objhd)='' then
      setname(objHd,CreateUUID);
    
    

    and store the master name in one of the slave PIO parameters.

    then you can get all you need in the slave PIO directly from the master.

    
    MasterHd := GetObject(PMasterName);
    AnyParam:=GetRField(MasterHd,GetName(GetRecord(MasterHd,1)),'AnyParam'); 
    

    On the other hand, you can store the Slave's name in the Master PIO so it can access the slave's info (Path area for instance)

  11. I don't exactly understand what you mean.

    What you can certainly NOT do is a PIO on 2 layers at once.

    What you could do is having a slave PIO that is on another layer than his master PIO and that set its position from the master's.

    When the master moves, on the other hand, it could reset the slave PIO. This last one is therefore always placed from the master's location...

    I hope this helps. If it does, I can explain more.

  12. Ok, that works great.

    But I now need to access real default parameters of my PIO's. The ones set is the Plug-in editor not the ones stored in the VW file.

    I could erase the PIO record definition (Delobject(GetObject(kObjectName))

    and create a new one

    tmpHan:=CreateCustomObjectN(kObjectName, 0, 0, 0, FALSE);

    DelObject(tmpHan);

    But then, all the PIO's present on the drawing become useless (Broken)

    You have another way?

  13. Well that's interesting because : (* Comments *) works also.

    I found this in the VS language guide and I used it lots of times.

    The alternate syntax is parenthesis asterisk:

    (* *)

    This can be used to comment out a block of the script that may already contain comments.

    For example:

    (* block comment

    {Some comment line.}

    {Another comment.}

    *)

×
×
  • Create New...