-
Posts
789 -
Joined
-
Last visited
-
As there are a lot of possibilities in how subobjects are generated and can interact with eachother and parent objects this can be hard to do. Lets hope they find the time to help you out 😉
-
You can't create your own event types, but you can tag along an existing one. I think you are overthinking this. What about using a parameter value to execute that specific action? That way, you only need to trigger the action by setting that record field/parameter to a specific value prior to resetting the object. Your object code can filter that value and decide what to do during the recalculate event. Setting that value and resetting the object can be done from anywhere as long as you have a refrence (HANDLE) to that object.
-
Vectorscript based tools/menu commands only live within their own event. They can't catch other events unless they are triggered. You can do this with the SDK. You could still keep the XML export as a vectorscript and make a small SDK project that triggers a vectorscript/menu command on a specific event.
- 1 reply
-
- 1
-
-
May the Force be with you. 🤖
-
In my case it was stored within the drag event sink itself, I believe you are trying something different. I would guess these two options could be useful? - Using "VWDataSerializerSimple" class to store the data directly into the object. I'm using this more and more because it's less work to maintain compared to records and fields. - In case the value is unique you could also store in permanent memory by using a VCOMImmediateImpl<IVWSingletonUnknown> interface. You could import/export into a custom interface which is accessible during the full execution of Vectorworks. Remember to handle document changes etc if you go this route.
-
I think that is exactly what you should do. I'm using this in one of my tools in "OnDrag()" and it does the job.
-
Mark Aceto started following Hippocode
-
Try this: gSDK->EditObjectSpecial(hObject, kObjXPropSpecialEditEditGroup);
-
Option 2 is probably the hardest because you have to be carefull with undo and manage all actions properly for two objects that are "bound" on a parametric base. There is another option 3. In the SDK you can choose if the recalculate event removes everything prior to recreation. The inner object would reside permanently in the outer. For simplicity option 1 is probably the best choice. It also depends of the interaction you need. Does the outer control the inner? Or in reverse order? If it's just a couple fields you could duplicate them in the parent object, which update the inner object with those same fields. This is probably the easiest method. If you use the option of the profile group, the benefit is that you can have a button in the info palette that opens the profile group and preselects the inner object, from that point the inner objec's palette is shown for direct access. On exit, you can have the parent object reset and use the new values. You can also extend the object info palette with custom fields that are linked to any object or data as long as you handle the conversion as you need to bypass the normal translation from/to, I'm doing this with several plug-ins combined with a selector widget (kWidgetSubSelection) that allows me to iterate several inner objects within the object info palette. This is great for a couple fields but those other options are probably better for larger palettes. Some small snippets for indication. bool IProvider_MEPComponent::OnWidgetChange(SShapePaneWidgetOnWidgetChange& data, bool& outNeedReset, bool& outChangeOk) else if(fWidgetsContainer.IsWidget(WidgetId, "ToggleLegs")) { outNeedReset = false; eventHandled = false; using namespace VectorWorks::Extension; if(fLegs.size() > 0) { IShapePaneWidgetAccess::ESubSelButton CurrentButton = data.fWidgetAccess->GetCurrentButton(); if(CurrentButton == IShapePaneWidgetAccess::ESubSelButton::eSubSelButton_CurrentButtonDown) { HighlightActiveLeg(&data); } else if(CurrentButton == IShapePaneWidgetAccess::ESubSelButton::eSubSelButton_NextButtonDown) { fNumActiveLeg++; HighlightActiveLeg(&data); } else if(CurrentButton == IShapePaneWidgetAccess::ESubSelButton::eSubSelButton_PrevButtonDown) { if(fNumActiveLeg == 0) { fNumActiveLeg = fLegs.size() -1; } else { fNumActiveLeg--; } HighlightActiveLeg(&data); } else if(CurrentButton == IShapePaneWidgetAccess::eSubSelButton_CurrentButtonUp || CurrentButton == IShapePaneWidgetAccess::eSubSelButton_NextButtonUp || CurrentButton == IShapePaneWidgetAccess::eSubSelButton_PrevButtonUp) { data.fWidgetAccess->ClearHighlightPoint(); data.fWidgetAccess->SetValueBool(data.fViewWidget, false); } } } You need to manage TransferValue in both directions for widgets not bound to default parameters of your object. In this case I'm referencing data from whichever inner object is the active selection from the previous selector widget. bool IProvider_MEPComponent::TransferValue(VectorWorks::Extension::SShapePaneWidgetTransferValue &data) { using namespace VectorWorks::Extension; bool handled = false; // For some widgets we need to switch over the record format to the active connector... if( fWidgetsContainer.IsWidget(data.fWidgetID, "Leg_DimensionType") || fWidgetsContainer.IsWidget(data.fWidgetID, "Leg_Length") || fWidgetsContainer.IsWidget(data.fWidgetID, "Leg_Shape") || fWidgetsContainer.IsWidget(data.fWidgetID, "Leg_Width") || fWidgetsContainer.IsWidget(data.fWidgetID, "Leg_Height") ) { if(fLegs.size() > 0) { sUserData_JunctionLeg* pLeg = &fLegs[fNumActiveLeg % fLegs.size()]; if(data.fTransferToView) { if(fWidgetsContainer.IsWidget(data.fWidgetID, "Leg_DimensionType")) { TXString strValue; strValue.itoa(pLeg->DimensionType); data.fWidgetAccess->SetValueString(data.fViewWidget, strValue); } if(fWidgetsContainer.IsWidget(data.fWidgetID, "Leg_Width"))data.fWidgetAccess->SetValueString(data.fViewWidget, pLeg->NominalWidth); if(fWidgetsContainer.IsWidget(data.fWidgetID, "Leg_Height"))data.fWidgetAccess->SetValueString(data.fViewWidget, pLeg->NominalHeight); if(fWidgetsContainer.IsWidget(data.fWidgetID, "Leg_Shape")) { TXString strShape; strShape.itoa(pLeg->Shape); data.fWidgetAccess->SetValueString(data.fViewWidget, strShape); } if(fWidgetsContainer.IsWidget(data.fWidgetID, "Leg_Length"))data.fWidgetAccess->SetValueReal(data.fViewWidget, pLeg->Length, IShapePaneWidgetAccess::eRealType_Coord); } else { if(fWidgetsContainer.IsWidget(data.fWidgetID, "Leg_DimensionType")) { pLeg->DimensionType = (VWFC::VWObjects::sUserData_JunctionLeg::eLegDimensions) data.fWidgetAccess->GetValueString(data.fViewWidget).atoi(); } if(fWidgetsContainer.IsWidget(data.fWidgetID, "Leg_Width"))pLeg->NominalWidth = data.fWidgetAccess->GetValueString(data.fViewWidget); if(fWidgetsContainer.IsWidget(data.fWidgetID, "Leg_Height"))pLeg->NominalHeight = data.fWidgetAccess->GetValueString(data.fViewWidget); if(fWidgetsContainer.IsWidget(data.fWidgetID, "Leg_Shape")) { pLeg->Shape = (eShape) data.fWidgetAccess->GetValueString(data.fViewWidget).atoi(); } if(fWidgetsContainer.IsWidget(data.fWidgetID, "Leg_Length"))pLeg->Length = data.fWidgetAccess->GetValueReal(data.fViewWidget, IShapePaneWidgetAccess::eRealType_Coord); // Save user data back into junction and reset it.. VWMEPJunctionObj JunctionObj(fhObject); JunctionObj.SaveLegs(fLegs); JunctionObj.ResetObject(); } } handled = true; }
-
I think you can't use a function as a procedure? Try making it return to a boolean value instead. result := SetWallPres...
-
What is the method for a script "remembering" input between runs?
Hippocode replied to SamIWas's topic in Vectorscript
Set/GetSavedSetting is by far the easiest option to use, but this is more commonly used for settings that surpass the scope of a drawing/document. If you need to remember these settings based on the active file you can also use a custom hidden record with a field for each setting you require. -
Make sure you are compiling with at least 10.15, target should be 10.13. If you still have an issue I find the easiest way to tackle this is to start fresh from a sample project and copy over your custom files and settings. Old projects can contain deprecated settings and after a while it's hard to find what is used and what not. Also make sure you compile generic to cover both ARM64 and Intel.
-
change value of record field in symbol definition
Hippocode replied to michaelk's topic in Vectorscript
https://developer.vectorworks.net/index.php/VS:GetObject Since the symbol definition is unique you can get the handle using its name. Be sure to verify the object type. -
It will be part of the VectorMEP 2022 release which should be available during September 2021.
-
Is it possible to run a script on start up?
Hippocode replied to Jayme McColgan's topic in Python Scripting
Yes this is only possible using the SDK. You could create a small SDK project that runs a specific python script on startup or any other event if you don't want to bring over the full script. -
You could have a script traverse all the rectangles in that layer, and number them in sequence for you. On default that would be stacking order, but you could also use coordinates to define the order instead, like relative position.