Letti R Posted May 27, 2022 Share Posted May 27, 2022 Hello, i want my tool to change the action that is needed to run, based on the mode that is selected in the mode bar. Unfortunately i cant find a fitting example, or i am overlooking it. The tool should behave like this: - First mode -> Run the tool after clicking on the drawing - Second mode -> Run the tool after clicking in 3d and catching the 3d point - Third mode -> Run the tool after drawing a line in 3d and catching start and end point How can i do this? I hope someone can point me in the right direction. (Sidenote: I am new to working with the SDK and new to writing in C++) Regards, Letti Quote Link to comment
Maarten DE Posted May 28, 2022 Share Posted May 28, 2022 This is not that easy, the most difficult part is overwriting the default behaviour in VWToolDefaultPoint_EventSink::HandleComplete(). This means you need to cover all the cases yourself. I had to do it too for one of our tools to go from a point mode to a line mode. However, if the object should not be inserted into a wall, it will make things a lot easier. Anyway, these functions need to be adjusted: VWToolDefaultPoint_EventSink::Init() SDefaultPointToolInfo toolInfo = this->GetToolInfo(); // Set the mode groups this->SetToolInfo( toolInfo ); VWToolDefaultPoint_EventSink::DoSetUp() // Set all the button images VWToolDefaultPoint_EventSink::GetStatus() IToolStatusProvider::GetTwoPointToolStatus() etc VWToolDefaultPoint_EventSink::DoModeEvent // When user clicks Mode Bar. VWToolDefaultPoint_EventSink::PointAdded() VWToolDefaultPoint_EventSink::PointAdded(); // Needs to be called when the last click is done (depending on your mode) // You can get the num of clicks that already happened with: this->GetToolPointsCount(); VWToolDefaultPoint_EventSink::HandleComplete() I think this is the minimum of functions you need to implement. 1 Quote Link to comment
Stefan Bender Posted May 30, 2022 Share Posted May 30, 2022 In GetStatus(), you may wish to return different status values depending on the current tool mode (how many points are required to be drawn?) and maybe on other things (2D/3D mode?). And of course, in HandleComplete you should check the current mode and do the appropriate stuff. 1 Quote Link to comment
Letti R Posted June 2, 2022 Author Share Posted June 2, 2022 Hello, thank you for your answers. This helped me alot. Regards, Letti Quote Link to comment
Letti R Posted June 24, 2022 Author Share Posted June 24, 2022 Hello, i just "finished" the first verion of my tool and when i compile it for windows everything works just fine. But when i compile the tool for macOS, the images in the mode bar (only in the mode bar) are missing (it shows an image of a red "x" instead of my image). Could this be because of the resolution of the mac i was testing on (4k)? And how do i add the "2x" images for the screens with high resolution? Also i think i did not set up or install the SDK on the mac correctly. Unfortunately i am not familiar in working with a mac. Is there a recent, easy to follow guide about how to setup the SDK and xcode? Regards, Letti Quote Link to comment
Maarten DE Posted June 24, 2022 Share Posted June 24, 2022 For the images on mac, you need to ad "@2x" to the image name, and that icon needs to be double the size of the normal image. So: YourToolName.vwr/Images/imageName.png YourToolName.vwr/Images/imageName@2x.png About setting up the mac, I can't help much because I struggle with that too 🙂 . Quote Link to comment
Letti R Posted June 25, 2022 Author Share Posted June 25, 2022 Hello, thanks for your reply. Im sorry for not pointing out that i already set up my images like that, but it still does not work. MyTool.vwr/Images/MyImage.png (26x20 pixel, 72dpi) MyTool.vwr/Images/MyImage@2x.png (52x40 pixel, 144dpi) And in the .cpp file i wrote it like this: TXStringArray imageSpecs; imageSpecs.Append("MyTool/Images/MyImage"); Is that enough or do i have to do something like: if operating system is mac imageSpecs.Append("MyTool/Images/MyImage@2x"); Unfortunately i cant just try it, because i dont have access to a mac right now. Regards, Letti Quote Link to comment
MullinRJ Posted June 25, 2022 Share Posted June 25, 2022 Have you tried saving your 2x image at 72 dpi? I have a very old memory whispering that it may be relevant. It’s an OLD memory so let me know if it is relevant. Thanks, Raymond Quote Link to comment
Maarten DE Posted June 25, 2022 Share Posted June 25, 2022 10 hours ago, Letti R said: And in the .cpp file i wrote it like this: TXStringArray imageSpecs; imageSpecs.Append("MyTool/Images/MyImage"); In our code, we've added the .png extention, maybe that's the reason it doesn't work in your end? TXStringArray imageSpecs; imageSpecs.Append("MyTool/Images/MyImage.png"); 1 Quote Link to comment
Maarten DE Posted June 25, 2022 Share Posted June 25, 2022 1 hour ago, MullinRJ said: Have you tried saving your 2x image at 72 dpi? I have a very old memory whispering that it may be relevant. It’s an OLD memory so let me know if it is relevant. The png's inside the Vectorworks.vwr file are also 72 and 144 dpi, and in our tools too, so that should not be an issue. Quote Link to comment
Letti R Posted June 27, 2022 Author Share Posted June 27, 2022 Hello, On 6/25/2022 at 7:33 PM, Maarten DE said: In our code, we've added the .png extention, maybe that's the reason it doesn't work in your end? This was the solution. Now the Images are also shown on a mac. Thanks alot for the help. Regards, Letti 1 Quote Link to comment
Letti R Posted December 1, 2022 Author Share Posted December 1, 2022 Hello, i compiled my tool with the 2023 SDK without changing anything in the code (the tool works without any problems in VW 2022). The compilation ends without an error, but when i tried to run the tool, VW crashed. My VW version ist 2023 SP1, and the SDK version is VW28.0.0. I think the crash occurs when tool points are cleared, but im not sure. I can get rid of crashing VW by using "VWToolDefaultLine_EventSink" instead of "VWToolDefault_EventSink", but than i dont know how to remove the 3 standard buttons in the mode bar . Also i noticed that everytime i crash VW a crash dump file gets created, is there a way to open these files and get meaningful information from them? And how do i find out what exactly causes VW to crash? Or would it be better to remove the standard buttons that come with "VWToolDefaultLine_EventSink"? Regards, Letti Quote Link to comment
Stefan Bender Posted December 2, 2022 Share Posted December 2, 2022 Maybe you need a 28.0.1 SDK. Some things might have changed internally. Quote Link to comment
Letti R Posted December 2, 2022 Author Share Posted December 2, 2022 Hello, is there a way to get the SDK for VW23 SP1, because when i download the SDK it is still version VW28.0.0. Regards, Letti Quote Link to comment
Letti R Posted October 15, 2023 Author Share Posted October 15, 2023 Hello, so i finished my Plug-in. Now i want to put it in the Forums to share it (for free). Is there something i have to consider to not run into legal problems because i used the VW SDK, or can i just put it out there for others to use? Regards, Letti Quote Link to comment
Pat Stanford Posted October 15, 2023 Share Posted October 15, 2023 Take a look at the Vectorworks SDK License.PDF file in the Read Me folder of the SDK download. Specifically Section 7. Having said that, I don't believe I have ever seen VW complain about anyone uploading PIOs that are offered for free. @Vlado Can you or someone from VW please comment. Quote Link to comment
Vectorworks, Inc Employee Vlado Posted October 15, 2023 Vectorworks, Inc Employee Share Posted October 15, 2023 15 hours ago, Letti R said: so i finished my Plug-in. Now i want to put it in the Forums to share it (for free). Is there something i have to consider to not run into legal problems because i used the VW SDK, or can i just put it out there for others to use? @Letti R we have nowadays the Partner Install feature, that allows users to install/add on features developed by third-parties. Send me an email to vstanev@vectorworks.net and I'll forward it to the correct people for that. 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.