Jump to content

Maarten DE

  • Posts

  • Joined


9 Neutral

Personal Information

  • Location

Recent Profile Visitors

352 profile views
  1. We made a function to import resources, that is using EImportResourceConflictResult, but it will prompt the user in case of a name conflict (so not 100% what you're looking for, what you ask for, I haven't come across anything like that in the SDK). MCObjectHandle ImportNestedResourceFromFile( VCOMPtr<IFolderIdentifier> idFolder, TXString extrFolder, TXString filename, eVWObjectType::Type vw_type, TXString name ) { IResourceManagerContentPtr importResManContPtr = nullptr; importResManContPtr.Query( VectorWorks::Extension::IID_ResourceManagerContent ); importResManContPtr->InitByTDType( (TDType)vw_type ); importResManContPtr->AddContent( EFolderSpecifier::kDefaultsFolder, extrFolder ); TXString fullPath; idFolder->GetFullPath( fullPath ); if ( importResManContPtr->SetSelectedItemText( name, fullPath + filename ) ) { MCObjectHandle ret = importResManContPtr->ImportSelectedResourceToCurrentFile( VectorWorks::EImportResourceConflictResult::eImportResourceConflictResult_AskWithUI, true ); DEBUG_Check2( ret != nullptr, (char*)"ERROR: Resource: %s cannot be imported to current file", (const char *)name ); return ret; } return nullptr; }
  2. I don't thinkg so, I have the feeling this is dealt with by the VS API, all these scripts messages 0. PROCEDURE Test; VAR h : HANDLE; BEGIN Message(h); END; Run(Test); PROCEDURE Test; PROCEDURE Proc; VAR h : HANDLE; BEGIN Message(h); END; BEGIN Proc; END; Run(Test); PROCEDURE Test; VAR b : BOOLEAN; FUNCTION Func : BOOLEAN; VAR h : HANDLE; BEGIN Message(h); Func := false; END; BEGIN b := Func; END; Run(Test);
  3. This does work for me, but I'm not 100% sure it's the best way to go... // Create an object and delete it. MCObjectHandle locus = gSDK->CreateLocus( WorldPt( 0, 0 ) ); gSDK->DeleteObject( locus ); // Check if object still exists in the drawing. VWObject obj( locus ); if ( obj.GetType() == 0 ) { // Object does not exist in the drawing anymore. }
  4. It might be a long shot, but if you take that part out, does the restriction work again? Because in our case, it fixed several issues (but again, I'm talking about several years ago, VW changed a lot since then).
  5. Not sure if it helps, but we had something alike several years ago, and the reason for it was that we adjusted our dashed preview when the user hoovered over a wall (for example, for some configurations, the frame should use the same thickness of its parent wall, so when the user hoovered over that wall, dashed preview was adjusted so the frame got the same thickness as the wall). Is see in your video that your dashed preview does change too when the user hovers over the wall (and at that moment, that red dashed line is gone too). We had to take the code that adjusted the object while hoovering over the wall out to fix the issue. I had a look in our repository but I couldn't find the fix anymore.
  6. That's odd, I'm doing the same thing (overriding and calling VWToolDefaultPoint_EventSink::PointAdded(); at the end) and don't get that locus... If it helps, I have this in the VWToolDefaultPoint_EventSink::Draw(IToolDrawProvider* pDrawProvider) function: pDrawProvider->DrawDefault2D(); And in TToolStatus VWToolDefaultPoint_EventSink::GetStatus(const IToolStatusProvider* pStatusProvider) return pStatusProvider->GetTwoPointToolStatus();
  7. A sample in the SDK that uses normal and dynamic control points and a custom data bar would be very usefull imo. And maybe even a Reshape tool overwite too. Now it's just way to much trail and error to get something to work. Where are you creating your dynamic ctrl Pts? I create mine in VWParametric_EventSink::Recalculate() and everywhere where I read the object's parameters. I use gSDK->CustomObjectControlPtSet(). The custom Data Bar, I create it in VWParametric_EventSink::OnCursorEvent(). But again, I'm far from having a perfect working version myself...
  8. I'm using the CParametricCustomBar class as Hippocode suggested, and it seems to work. I still have some issues with it though, I have to tackle them later when I have more time.
  9. Thanks again 🙂 . I did notice that in IProviderCursorHandles, all the OnCursorAction_ ... and OnCustomBarEvent functions only get hit when clicking/hovering/... over parameter control points, not the dynamic created control points. Strangely enough, the GetHandle... functions of that class do get hit when clicking/hovering/... over dynamic created control points. Has anyone notice the same thing?
  10. Thanks Wouter, the creation of the control points works now. A question: is it possible to have a custom data bar while dragging a custom control point? I tried this in a overwrite of VWParametric_EventSink::OnCursorEvent( ParametricMessage* message ), case message->fAction = ParametricCursorMessage::EAction::kAction_MouseDown: CustomBarRefID outCustomBarRefID; bool b = false; b = gSDK->CustomBarCreate( 1, outCustomBarRefID ); b = gSDK->CustomBarInstall( outCustomBarRefID ); CustomBarFieldInfo fieldInfo; fieldInfo.fFieldLabel = "Length"; fieldInfo.fFieldValue = 1000; fieldInfo.fIsEditable = true; fieldInfo.fIsLocked = false; b = gSDK->CustomBarSetFieldInfo( outCustomBarRefID, 0, fieldInfo ); // b = gSDK->CustomBarRelease( outCustomBarRefID ); It still shows the default data bar but all values are empty. When I don't use gSDK->CustomBarRelease() (because it returns false) the data bar values are still empty, except the first (X) has a reversed S in it... I tried the same in and overwrite of IProviderCursorHandles::OnCursorAction_MouseDown( ICursorHandleActionContext* context ) but that one doesn't even get hit (even when I remove the overwrite of VWParametric_EventSink::OnCursorEvent( ParametricMessage* message )). This doesn't work either. TXString lab = "Length"; gSDK->SetDataDisplayBarField( 0, barLength, lab ); gSDK->SetDimUserBarValue( 0, 1000 ); In the VWTool_EventSink class, I found these functions, but I don't think I should use them because the Control Points are part of the object, not the tool. Also, when I implement them, they don't get hit. virtual void OnCustomBar_Setup(); virtual void OnCustomBar_Setdown(); virtual void OnCustomBar_UpdateValues(); virtual void OnCustomBar_LockValue(size_t fieldIndex, const TXString& userString); virtual void OnCustomBar_UnlockValue(size_t fieldIndex); virtual void OnCustomBar_LockValue(const CustomBarLockValueData& lockData); virtual void OnCustomBar_UnlockValue(const CustomBarLockValueData& lockData); Did anyone got this to work in their PIO?
  11. Hi all Is anyone able to create Control Points on the fly? On this page (and also in the SDK manual) it's explained but I think this is some old code because I can't find any case of that switch (action) in the SDK.
  12. I'm using gSDK->AddObjectToContainer() now and it seems to work fine. But I'll keep that InsertBefore/InsertAfter in mind whenever something strange pops up on the way, thanks for the tip! And you're right about the nullptr, the function will already create a new instance. I've been out of the whole computer/programming/Vectorworks world for several years so it's all a bit rusty, but it's slowly coming back 🙂 .
  13. Hooray, that did the trick indeed 😄 . I got thrown off because in check 5, I did get the container info (the layer) so I assumed I didn't had to add it another time... Never a boring day with the SDK 🙂 . Thanks for the help!
  14. I forget to mention, I tried the same with the gSDK->... functions too, same result, no symbol instance in the drawing.
  15. Hi all I want to create a symbol definition and place an instance of it in the drawing (active layer). I'm probably missing the obvious here, but why doesn't this work: // 1. Create the symbol definition, add a line to it. TXString symName = "a unique symbol name"; VWSymbolDefObj symDef = gSDK->CreateSymbolDefinition(symName); symDef.AddObject(gSDK->CreateLine(WorldPt(0, 0), WorldPt(100, 100))); // 2. Reset to make the line visible in the symbol definition. symDef.ResetObject(); // 3. Refresh Res Browser to make symbol def visible. gSDK->RefreshResourceBrowserResourcesList(true); // 4. Place this symbol on the active layer (reset all just to be sure) VWSymbolObj symInst(symDef, WorldPt(0,0), 0); symInst.ResetObject(); symInst.SetVisible(true); symInst.ResetObjectsVisibility(); // 5. as a check: get the name of the layer the object is placed on. MCObjectHandle* pOutContainerHandle = new MCObjectHandle; short* pOutContainerType = new short; double* pOutContainerScale = new double; symInst.GetContainerInfo(pOutContainerHandle, pOutContainerType, pOutContainerScale); VWLayerObj lay(*pOutContainerHandle); TXString layName = lay.GetName(); // The name of the layer is correct, but the symbol is not visible/selectable on the active layer. Step 1, 2, 3 works fine, the symbol definition is created and visible in the Resource Browser. I can manually drag and drop it in the drawing. Step 4 and 5 seems to work too, I get the container info (the active layer) but still, I don't see the symbol in the drawing. Oh, and I'm doing this in CMenu_EventSink::DoInterface();
  • Create New...