Jump to content

Tobias Döngi

Member
  • Posts

    12
  • Joined

  • Last visited

Posts posted by Tobias Döngi

  1. 12 hours ago, Jayme McColgan said:

    so what is the handle parameter  the first function is referencing? is that what is currently selected?

    The first method is a callback function. That means VW will call it for every object matching the search criteria. So the handle is a pointer to one currently selected VW object.

     

    8 hours ago, Jayme McColgan said:

    what should i be using to get the symbol type?

    I strongly encourage you to use the small clipboard button. There you will also find a menu named "Procedures". Having a look at the "Object Info" topic provides you with vs.GetTypeN(h). You have to provide it with above mentioned handle and you'll get the object type.

     

    8 hours ago, Jayme McColgan said:

    can i inset a symbol from a drawing thats in my favorites folder?

    Yes you can but you have to create a resource list and import the symbol into the current document first. After that you can place the symbol within the drawing.

     

    8 hours ago, Jayme McColgan said:

    this one is more of a general python question but i need to find the length of the side of a 90º triangle only knowing the length of 1 side and 2 of the angles. ive tried what i though was correct but doesn't seem to come up with the right answer... ive attached a picture and the code i tried for reference. in the image I'm trying to find the length of the A side.

    math.tan() expects radians you are providing degrees. You can convert it by using math.radians(angle_a.)

    • Like 1
  2. The call you're looking for is vs.ImportDXFDWGFile so your script could look like this:

    isBatch = True
    result = vs.ImportDXFDWGFile('C:\\155_01_237_1.dxf', isBatch)
    
    vs.AlrtDialog('Result: {}'.format(result))

    Setting isBatch to 'True' avoids annoying config dialogs. For macOS you should experiment with the path specifier I'm sure you have to use slashes but haven't tried it.

     

    Warning: The online developer reference for this function is outdated, you should use the reference within the script editor accessed by the small clipboard with arrow button.

    • Like 1
  3. Hi Jayme,

     

    there is no specific method like vs.GetSelectedObjects() for retrieving the objects conveniently. Instead of that you iterate all objects in a specific context and match them against a search criteria. I.e. all rectangles in document or a given layer and so on. So what you want is traversing all objects in the current document and collect all selected ones. Following script does the trick:

     

    OBJECTS = []
    
    def collect(handle):
    	OBJECTS.append(handle)
    
    vs.ForEachObject(collect, '((VSEL=TRUE))')
    
    vs.AlrtDialog('Num selected objects: {}'.format(len(OBJECTS)))

    Check out those resources for additional help:

    https://developer.vectorworks.net/index.php/VS:ForEachObject
    https://developer.vectorworks.net/index.php/Python

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

     

    • Like 1
  4.  

    21 hours ago, Nicolas Goutte said:
    Quote

     

     

    Also is there a way around the fact you can't seem to edit a door of a cabinet without deleting the shelves/division first to edit the door and then re-adding the division back in?

     

    Again, here too, in short: in the dialog, tab "Division", select one box, then click the symbol with the arrow for expanding the selection, until you have the right selection for the door you want to change.

    You can do this even faster by holding the alt key down while clicking the desired box.

    • Like 2
  5. If you are trying to set the palette visibility on Windows then this call will not work at all. Please see my answer in above mentioned thread. You would have to retrieve the WindowsOSData, parse the XML, find the corresponding palette there and alter its visibility. As far as I know this cannot be done via SDK yet.

  6. It depends on which platform you are creating the new palette. Under Windows you cannot set the visibility state by API. This is due to the fact that NVI is using a third party module for rendering all the palettes. You can see this when opening a Windows workspace file in a text editor. There is a special tag WindowsOSData. That's a xml subsystem with own palettes and settings specific to the Windows platform. You can retrieve this data by calling:

    		TXString newWinOSData;
    
    		workspaceFile->GetWindowsOSData(newWinOSData);

     

  7. Hello,

    I'm using following code to create new tool palettes:

    VCOMError XGWorkspaceCreator::CreateNewToolPalette(const TXString& paletteName, IWorkspaceFile* workspaceFile, IWorkspaceToolPalette** newToolPalette)
    {
    	VCOMError error = kVCOMError_Failed;
    
    	if (workspaceFile) {
    
    		TXString toolPaletteID;
    		CREATE_TOOLPALETTE_ID(toolPaletteID, error);
    		workspaceFile->CreateToolPalette(toolPaletteID, newToolPalette);
    		(*newToolPalette)->SetDisplayName(XG::Win2MacString(paletteName));
    	}
    
    	return error;
    }

    Where workspaceFile points to a workspace file within Vectorworks program directory.

    • Like 1
  8. As mentioned in the title I'm wondering what the method bool IResourceManagerContent::GetSelectedResourceIsDocument() does. 

    My first thought that it validates if the selected resource is already in document proofed wrong after some debugging and importing resources and re-importing them. And what the name suggests if the selected resource is a document sounds somewhat weird.

     

    Can anyone help?

     

    Best regards

    Tobias

×
×
  • Create New...