JBenghiat Posted April 29, 2021 Share Posted April 29, 2021 Does anyone have any advice or examples for creating a custom data bar? I can't seem to figure out the right place to call CustomBarCreate() and CustomBarInstall(). Quote Link to comment
Maarten DE Posted April 29, 2021 Share Posted April 29, 2021 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. Quote Link to comment
JBenghiat Posted April 30, 2021 Author Share Posted April 30, 2021 Thanks @Maarten DE, using CParametricCustomBar was quite useful. Vectorworks was hanging when I used the ISDK calls, and the VWPluginToolCustomBar class seems to require first initializing an array of CustomBarRefID's, which is a bit confusing. I have everything working, except that the very first time I run the tool each session, the data bar is blank. I was also hoping to use SetDataDisplayBarField to automatically handle certain data types, but that didn't seem to work for me. For a custom tool, I'm calling the create and install commands from PointAdded(). I'm overriding the OnCustomBar_ methods for setup, update, lock, and unlock. if ( this->GetToolPointsCount() == 1 ) { if ( fCustomBar.GetCustomBarID() == 0 ) { fCustomBar.Create(); fCustomBar.Install(); } } else { fCustomBar.Release(); } Quote Link to comment
JBenghiat Posted April 30, 2021 Author Share Posted April 30, 2021 And I seem to be experiencing the same thing with control points — the first click in a Vectorworks session, and the custom bar does not load, but functions as expected after that. Quote Link to comment
Maarten DE Posted May 1, 2021 Share Posted May 1, 2021 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... Quote Link to comment
JBenghiat Posted May 5, 2021 Author Share Posted May 5, 2021 I also create the control points in the recalculate event sink, and have a method that uses CustomObjectControlPtSet() to create all the control points. I have an enum defined for all the control point IDs. I'm using an implementation of IProviderCursorHandles to handle the control point actions, as well as set custom tool tips and images. Ended up creating a child class of CParametricCustomBar that has methods for setup, update, lock, and unlock, so I could easily use the same custom bar for the insertion tool and control points. In both cases, I'm not seeing the custom bar the very first time in a Vectorworks session. For control points, I only see the custom bar in 2D views. I tried installing and releasing the custom bar during the constructor, but that doesn't help. Otherwise, everything is working as expected. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.