Nicolas Goutte
-
Posts
411 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Articles
Marionette
Store
Posts posted by Nicolas Goutte
-
-
-
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
-
Using ISDK::GetActiveDocument is no help either, as it still gives the real path of the document, not the one currently used to save. (Tested on Windows)
-
VW 2022 seems to have changed its behavior and sends the kNotifyDocPostSaved notification, when a backup is made.
So my question is: how do I know that the current kNotifyDocPostSaved is due to backup and not due to a regular saving.
(I have to do things when the file is saved normally, but not when it is saved as a backup.)
-
12 hours ago, Maarten DE said:
gSDK->CloseDocument(); gSDK->HandlePendingUpdatesAndActivates(); //workaround for bug in OnFileContent: to trigger closedocument
Thank you for the trick. It makes indeed a difference.
- 1
-
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
-
We are currently limited by the problem that during a menu command only a limited number of VW files can be opened, because, even if are closing them, they are not immediately closed, but only when the menu command is done.
Similarly, such an operation cannot be done either as a migration manager callback.
Does somebody knows a way to get around this?
-
OK, my old Time Machine has still the old versions:
- VW 2017 had a Python 3.3 (I suppose 3.3.2)
- VW 2018 had already a Python 3.5 (probably 3.5.2)
- 1
-
- VW 2013 hat no Python yet
- VW 2014 had apparently Python 3.3.0
- VW 2015 had Python 3.3.2
- VW 2016 had Python 3.3.2Sorry, I have no VW 2017 and 2018 at hand to check what they had.
- 1
-
VW 2019 and 2020 use Python 3.5(.2)
(Stay tuned, I tried to find the older version. I am sure that Python 3.3.3 was used but I do not know which VW)- 1
-
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.)
-
OK, thank you for your ideas.
-
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.
-
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.)
-
I suppose that it is not possible. BuildResourceList and Co. (be it in C++, VS or Python) do only work on VW document of the current major version (e.g. 2022 document for VW 2022). That has been always that way, for as long as I know VW (i.e. 2007).
-
On 8/18/2021 at 3:11 PM, Nebeor said:
I would like to to see the debug assert messages on runtime, just like in VW2015, but that seems to be more complicated to achieve.
We (the interiorcad team) sorted this out by making our own assert-Macro, controlled by our own #define.
-
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.)
-
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
-
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.
-
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.)
-
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
-
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 ) -
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.
- 1
-
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.
Translator
in Python Scripting
Posted
The object types are documented for the C++ function ISDK::GetObjectType: https://developer.vectorworks.net/index.php/VCOM:VectorWorks:ISDK::GetObjectType