Jump to content

KN_Michael

Member
  • Content Count

    8
  • Joined

  • Last visited

Everything posted by KN_Michael

  1. I have something like following: VWObject obj = ...; // object comes from for each iterator e.g. VWParametricObj params = VWParametricObj(obj.GetThisObject()); for (int i = 0; i < params.GetParamsCount(); i++) { // read parameters... } My problem is, that I can't read the parameters of lines, rectangles and other simple build in objects. E.g. if obj.GetType() == kLineNode or kBoxNode, how can I get all existing parameters of this object? Other things I tried: Additionally, I tried GetCustomObjectDefinition, which seems not to work for build in object types. And VWRecordObj, but this does not work either, which makes sense, as I can see, that the build in object types do not contain any aux object of type kRecordNode...
  2. KN_Michael

    Getting all parameters of build in objects (line, rects, ...)

    So far I'm comparing following: object type, object class, bounding box, object matrix, all values of VWObjectAttr, and all values in VWParametricObj for custom objects. I'm aware that this is a heavy task, but I'm trying to solve it currently. Duplicates come from imports as I've written above, especially from DWG imports. We do NOT control those imports, they come from other companies - so I can't improve anything on this side. We can see that there are apperantly duplicate symbols in the imported data - they are not unique and just differ in rotation or similar (although a smart purge could clean this as well, but this is not what I'm trying to do, that would be too much for now). To answer the why, we have really large files because we have a lot of data in each file so we are trying to optimise whatever is possible. We need to import stuff from other formats where we do not control data nor the format, again a lot of data comes into our files. Last but not least, our colleagues never work perfectly, which additionally leads to the need to optimise layouts... Additionally, we have already created a feature request for this purge command, but we won't get it in the near future (if ever), so I try to write my own solution for now.
  3. KN_Michael

    Getting all parameters of build in objects (line, rects, ...)

    Thanks for the feedback. I'm aware that those objects are no plugin objects, my code only shows what I would like to have. Finally I'm trying to write my own purge function for symbols. We are importing a lot into our layouts and therefore I want to find symbols that exist multiple times (I assume sometimes we have 500 symbols that are actually the same). I would like to avoid a switch for each type and handle lines, rectangles and other types on a per type base, I would like a more generic solution (like iterating over every parameter). As this approach is error prone as I may forget a type, may forget a property of a type and so on... I was hoping that build in types do something like this as well. E.g. I can see something like "Coincident Duplicate Objects for" under the purge command - how does this command work? It finds duplicate objects and identifies them as duplicates - is there nothing that this command uses that I can use as well? @JBenghiat, thanks for the code shortening hint
  4. KN_Michael

    Module registration order

    Via trial and error I found out that modules seem to be loaded alphabetically. Can I rely on this observation? I have something like following structure: Core.vlb Module1.vlb Module2.vlb And want to use functions of Core.vlb inside the plugin_module_main functions inside my modules. With the naming schema from above this works fine. Is it save to do it this way?
  5. KN_Michael

    Module registration order

    I'm aware of the interfaces and use them. Still having 20 vlbs, I don't want to compile the same code into each and every vlb just for a simple thing like reading a setting file. Sure, it's not much code, but it goes against my coding style to compile the same code into every single vlb... As you are correctly reading, I'm governing which modules get registered for which user on which system and similar... Also, if I want to make a change in one vlb, I compile it, release it and I am finished. If I compile the code into every vlb, I have to recompile new releases for all of them as well and distribute them... If I do not use the VCOM interfaces inside plugin_module_main everything works fine of course and I do use this a lot anyways... I have just problems in this special case.
  6. KN_Michael

    Module registration order

    It does matter in my case. I do register tools, plugins and so on depending on a function from my core module (it reads a setting file). If I rename my core module to XCore.vlb, my Module1.vlb and Module2.vlb are loaded before my core module and calling a function from the core module inside `plugin_module_main` (<= this is the important part, all other code is called only after all modules are registered) will crash because the core module was not registered yet...
  7. KN_Michael

    Creation of temporary objects while tool is active

    We created a small vs script with only one function in it (http://developer.vectorworks.net/index.php/VS:ReDrawAll) and call this one if we need to redraw the screen. Can be even created "on the fly" from within the code, something like this should work: TXString script; script += "import vs;"; script += "vs.ReDrawAll();"; VectorWorks::Scripting::IVectorScriptEnginePtr vsEngine(VectorWorks::Scripting::IID_VectorScriptEngine); bool outWasCompiledSuccessfully; Sint32 outLineNumberOfSelectedError; TXString outErrorText; if (VCOM_SUCCEEDED(vsEngine->CompileScript(script, false, outWasCompiledSuccessfully, &outLineNumberOfSelectedError, &outErrorText))) { if (VCOM_SUCCEEDED(vsEngine->ExecuteScript(script))) { // SUCCESS... } }
  8. Background I'm trying to calculate connection points between objects by throwing each object I create/edit after creation/change/delete into a custom IVWSingletonUnknown object. In this class I have a simple queue collecting those objects. This queue is processed later on whenever vectorworks reports an idle event (kNotifyAfterPendingUpdate). In the idle event I now process the queue. What happens in the idle event I simply iterate over all objects in the queue, calculate some internal data (like connection point X is connected with object Y's connection point Z) and save this data into the objects (in a custom tag). Afterwards I call gSDK->ResetObject(handle) with every object that has changes - because connections are drawn by each object to be visible to the user. This works fine until I try to undo/redo events Problems I face It seems like that I can't change objects from the idle event without them being pushed into the undo table - I want to avoid this. I see that trying to undo a delete after the idle event regenerated objects is not working anymore - simply nothing is happening in VW although the old handle reappears in code but is not really restored as it does not reappear in VW. Can someone help me with this problem? Can I somehow exclude all actions done in the idle event from the undo system (without clearing the undo table)? I manually take care that objects push theirself into my singleton manager class after restore and before deletion and so on, so I really want that VW ignores any change I make to my objects in the idle event.

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×