Jump to content

Nicolas Goutte

Member
  • Posts

    411
  • Joined

  • Last visited

Posts posted by Nicolas Goutte

  1. OK, the trick seems to be that in PreSave a .swap is triggered on PreSave when the file is about to be overwritten. (Normal "Save" or Autosave on the same file) A .vwx in the other cases.

     

    "Save As" (or "Save" with dialog) can be catch by checking the path during PreSave and PostSaved: it is then the same (unlike for "Save Copy As", where it is different)

     

    An Autosave on Backup will have no .swap file in PreSave and its path is also different in PreSave than in PostSaved.

    (I think that these are all relevant cases. It was rather hard to find out.)

     

    PS.: all paths are get by ISDK::GetActiveDocument

  2. The code we are trying is similar to this one.
    (The crash comes in both cases, the #if 1 case (real documents) or the #else case (empty documents).
     

    	using namespace VectorWorks::Filing;
    #if 1
    	// Opening real documents of Libraries\Default in the VW program folder
    
    	IFolderIdentifierPtr libraryDefaultsIdentifiier(IID_FolderIdentifier);
    	libraryDefaultsIdentifiier->Set(kDefaultsFolder, false);
    
    	class Listener : public IFolderContentListener {
    	public:
    		EFolderContentListenerResult VCOM_CALLTYPE OnFolderContent(IFolderIdentifier* pFolderID) override
    		{
    			return eFolderContentListenerResult_Continue;
    		}
    
    		EFolderContentListenerResult VCOM_CALLTYPE OnFileContent(IFileIdentifier* pFileID) override
    		{
    			TXString path;
    			pFileID->GetFileFullPath(path);
    			if (path.ReverseFind(".vwx") >= 0)
    				paths.Append(path);
    
    			return eFolderContentListenerResult_Continue;
    		}
    
    		TXStringArray paths;
    	};
    
    	Listener listener;
    
    	libraryDefaultsIdentifiier->EnumerateContents(&listener, true);
    
    
    	for (const auto& path : listener.paths) {
    		IFileIdentifierPtr pathFileIdentifier(IID_FileIdentifier);
    		pathFileIdentifier->Set(path);
    		gSDK->OpenDocumentPath(pathFileIdentifier, false);
    		gSDK->CloseDocument();
    	}
    
    #else
    	
    	// Opening only empty documents
    	for (int i = 0; i < 100; i++) {
    		gSDK->OpenDocumentPath(nullptr, false);
    		gSDK->CloseDocument();
    	}
    
    #endif

     

  3. I do not know a definitive answer to this. We do have our problems with invalid handles at times too.

     

    You can check not only that the handle is a nullptr but its dereference (*handle) too. However that is not enough either.

     

    The next step is to check its the parent layer return for that object. The layer and its parent should not be null. (Not sure if this is valid for symbols, because in in our code, why have extra code for symbols too.)

  4. On 10/18/2021 at 4:49 PM, JBenghiat said:

    There is a migration interface. I haven’t implemented it, so I don’t know is you can easily find it in the SDK — I know I have it in an email somewhere. 
    You can also either call the file up-convert interface or listen for the plug-in update event — I presume handling would be the same whether called for an individual  file or a batch convert. 

    I know only interfaces for handling a plug-ins' part of a migration. However that does not help me, as Batch Convert is triggered by the library conversion part of the migration, something which is pure VW code.

  5. Is there a way to know that a code is called in the middle of a migration or in middle of a Batch Convert?

     

    (Both, Migration or Batch Convert, started by a user, not by our code. Therefore I do not have the option of giving a callback to the Batch Convert, as when I call the corresponding SDK call.)

     

     

  6. On 6/19/2021 at 1:27 PM, hisa said:

    Is it possible to solve it by executing the xattr command and then uploading it to the Internet?

    No, the whole quantize stuff is a feature of macOS. As long as you use Safari, you will have the problem.

     

    May be instead of zipping it , you could pack it in a signed and notarized DMG. (However, personally, I have only put installers in such DMG, not a single VW-Plugin that  user could copy. Therefore I do not know it it works.)

  7. Do you ZIP the plug-in and download it per Safari afterwards?

     

    Then in this case, the archive is quarantined. You have to de-quarantine the archive before you unpack it:
     

    xattr -d com.apple.quarantine archive.zip

     

  8. 12 hours ago, Stephan Moenninghoff said:

    Not sure why they come up metric. When you first installed interiorcad you were asked to choose. Did you choose imperial then as well? Can you shoot me a document where you are getting metric units?

     

    Internally VW is metric (in Millimeters to be exact). That is why the exports are primarily metric too.

  9. 1 hour ago, Sam Jones said:

     

    "something like:"  I'm afraid I need you to be way more specific. 

     

    In vectorscript:

    VAR

         ok : BOOLEAN;

     

    ok := GetCurrentMode & 8

     

    I have ggogled a bit (my Pascal is really rusty meanwhile that I do not use neither Pascal nor VectorScript) any more:

     

    ok := (GetCurrentMode & 8 ) = 8

     

    (You cannot assigned an integer to a boolean in Pascal, like you can do in other languages.)

  10. 1 hour ago, Sam Jones said:

     

    "something like:"  I'm afraid I need you to be way more specific. 

     

    In vectorscript:

    VAR

         ok : BOOLEAN;

     

    ok := GetCurrentMode & 8

    Gives a meaningless result.  

     

    Sorry, Imenat it in Python

     

     

    1 hour ago, Sam Jones said:

    Patrick, I would love to know how you figured this out.

     

    That is classic way to do things (especially in old C days). If you see constants that are 1, 2, 4, 8, 16... you have a good chance that the values are ORed

  11. On 3/31/2021 at 1:41 AM, Sam Jones said:

    According to the VS Reference

    When I run:

    vwMode := GetCurrentMode;

    vwMode should have one of the following values

     

    FUNCTION   GetCurrentMode:INTEGER ;

     

    Python:

    def  vs.GetCurrentMode():

       return INTEGER

    Description:

    Returns the current application protection mode.

    Return values:

    [...]

    8 - Student Mode

    [...]

     

    If I need to determine if the running VW program is a student version, how do I do that?

     

    You must write something like:
    bool( vs.GetCurrentMode() & 8 )

  12. 39 minutes ago, matteoluigi said:

    in Python I tried (running in a foreach-procedure, it has to filter all slab styles, which names contain the letters BST): (i read somewhere that '.+' is the Asterisk equal for python)

    if outValue == ('.+BST.+'):

     

    however, it doesn't filter work, why?

     

    If you want to use regular expressions, you have to use explicitly the module "re", the one handling regular expressions: https://docs.python.org/3.8/library/re.html

    Be careful that in regular expressions .+ means "at least one character", which might not what you seem to want.

    • Like 1
  13. 27 minutes ago, zoomer said:

    Is it still the way that if I plug a single USB 2 device into

    a USB 3 Hub, that alle other devices will also get only

    USB 2 speed ?

    So necessary to sort your USB devices and use separate

    USB outputs for each USB Speed Hub ?

    (Which is basically what I still do)

     

    For example, when make use of the USB 3 Hub of my Wacom

    Cintiq and plug a USB 2 CADMouse in, external USB 3 SSD

    cases would also run USB 2 speed only at the Wacom Hub ?

     

    Not sure about that. (I think there is a special mode in USB 3 to avoid that... but I am far from being a USB specialist.)

     

    I meant more from CPU to device. No need of a USB 4 hub if your computer kann only do USB 3.

×
×
  • Create New...