Jump to content

Maarten DE

Distributor
  • Posts

    89
  • Joined

Everything posted by Maarten DE

  1. Just thinking out loud here, but wouldn't a 2D Path PIO be better in this case? That way you can calculate the angle between each consecutive line segment of the poly.
  2. In the past FIn3D( wallHandle ) worked to get the first inserted object in the wall. NextObj will get you the next etc. I just did a quick search and here's an example that you might change for your needs:
  3. And this does not work, so I guess they need to overlap? PROCEDURE Test; VAR poly1, poly2, polyOut : HANDLE; BEGIN Poly( 0,0, 10,0, 10,10, 0,10 ); poly1 := LNewObj; Poly( 10,0, 20,0, 20,10, 10,10 ); poly2 := LNewObj; polyOut := CombinePolygons( poly1, poly2, 1 ); END; Run(Test);
  4. Seems to work fine here... Windows 10 VW2024. PROCEDURE Test; VAR poly1, poly2, polyOut : HANDLE; BEGIN Poly( 0,0, 10,0, 10,10, 0,10 ); poly1 := LNewObj; Poly( 5,5, 15,5, 15,15, 5,15 ); poly2 := LNewObj; polyOut := CombinePolygons( poly1, poly2, 0 ); END; Run(Test);
  5. This looks like a webdialog. As far as I know, only possible with the SDK (c++) to create that dialog. The content of the dialog is html etc.
  6. I see, I tried it now too and indeed, it doesn't close the dialog in the LB events... Sorry, I'm out of ideas.
  7. I haven't tried it in a LB, but we force-close our dialog calling currentDialog->OnDefaultButtonEvent();
  8. I rarely write VS nowadays, and if I do I use the build-in VS editor of VW which I think works pretty good for the things I need to do. So I'll not update that file anymore, but feel free to do so! BTW, I found the other file, it needs to be placed here: C:\Users\*yourUserName*\AppData\Roaming\notepad++ . This way you can use Vectorscript instead of Pascal. But be aware, this file is from 2014, so same as that other file, it's outdated, but feel free to add the new functions to it. userDefineLang.xml
  9. On Windows you can use Notepad++. Fresh installed you can use the Pascal Syntax highlighting, that sure helps a lot for the readability. If you want VectorScript syntax highlighting and auto completion, you need to add a few files. Here's some more information but it seems all the download links are down... 😞 However, it seems my version can still be downloaded from Notepad++ itself: https://github.com/notepad-plus-plus/userDefinedLanguages/blob/master/UDLs/VectorScript_byMaarten.xml , I haven't checked if it still works though...
  10. A very dirty way to save you some time: Change the document units in the beginning of your script to whatever unit your dimensions inside your script are and at the end of the script restore them. However, I wouldn't recommend this, it wouldn't surprise me this unit change would trigger some recalculations of other objects inside the drawing, so it can slow down your plug-in. But if it's for personal use and you are aware of this, it might be a solution. PROCEDURE Example; VAR unitsPerInch : REAL; BEGIN { get original document units } unitsPerInch := GetPrefReal( 152 ); { all the dimesions in this script are in mm, so set document units temporary to mm } SetPrefReal( 152, 25.4 ); { the script } Rect(-100, 100, 150, -150); { restore original document units } SetPrefReal( 152, unitsPerInch ); END; Run(Example);
  11. 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.
  12. 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");
  13. 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 🙂 .
  14. 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.
  15. Since you know where the matrix is located in the aux list, you should be able to adjust it using the aux functions: https://developer.vectorworks.net/index.php/Category:VCOM:VectorWorks:ISDK(Auxiliary_and_Data_Objects) I thought I had some code where I adjusted something in an aux list, but I can't find it anymore...
  16. Or, if you really want to count actual objects (even if they don't have any geometry), you could create a line with zero length and attach a record to that. We do that to be able to count subparts (for example, when you have a 2D only representation, and the objects above the cutplane will not be drawn, but you still want them in your worksheet, you could use this methode).
  17. Maybe you can use a default library? In that library you have symbols of screws etc and your PIO imports the one you need and uses them. Good thing is, you don't need to create any geometry in your PIO, only place the needed symbol instance. They also show up in a worksheet (and yes, I know, these are bolts, not screws 🙂 ). BTW, this tool is very fast, I filled in 1000 in numScrew and it takes less then a second to recalculate. PIO inside PIO would not be a good idea, because each nested PIO will be recreated (thus redraw the geometry) when you reset the main PIO. So it will be slower than just drawing the screw geometry inside the main PIO. Something else you can do, inside your PIO, create the geometry once, and duplicate it the number of times you need it, but I don't see it making such a big difference than creating the geometry inside a FOR loop. In this case you do need to have a way to make these inobject elements show up in a worksheet, you can do this by attaching a record to them. Or, if it's just quantity, write that quantity to a parameter of the PIO and show that inside the worksheet. I'm sure there are other ways of doing this too, these are the one I could think of 🙂 .
  18. To get the Object Type, you could use the "Debug List View Ex..." command. Create the resource you want to get the type of and give it a name, and in "Debug List View Ex...", use "Find Object..." to search for its name, and in the list you can see the Object Type.
  19. This works for me... PROCEDURE ResListTextureStyles; VAR listID, numItems: LONGINT; BEGIN listID := BuildResourceList( 106, 0, '', numItems); Message(numItems); END; Run(ResListTextureStyles);
  20. If my memory is not failing me, it was gSDK->GetTextureMappingInfoN();
  21. Hi Stefan I'm not sure it will work in your case because we create our widget via: void IProviderShapePane::Init(CodeRefID objectID, IExtendedProps* extProps) { IWidgetsEditProvider* widgetsProvider = NULL; if ( extProps && VCOM_SUCCEEDED( extProps->GetObjComponentTypeWidgets( objectID, kObjectRootComponentTypeID, widgetsProvider ) ) ) { widgetsProvider->AddWidget( kWidgetID_SizeType, .... not automatically via a kFieldPopUp. But this is how we fill the pull down dynamicly: void IProviderShapePane::Update( IWidgetsProvider* widgetProvider ) { SWidgetDefinition* pSizeTypePU = widgetsProvider->GetWidgetByID( kWidgetID_SizeType); IWidgetDataPopup* pPopupData = dynamic_cast<IWidgetDataPopup*>(pSizeTypePU->fpWidgetData); pPopupData->Clear(); std::vector<TXString> listOptions = this->GetListOptions(); for ( size_t i = 0; i < list_sets.size(); i++ ) pDataSetPU->Add( TXString::ToStringInt( i + 1 ), listOptions[i] ); } Off course, this is not dimming or disabling, but it might work too for you?
  22. Wow, be aware this is a very difficult thing to do, it will take some time to implement this. In VW, you have all sort of 3D geometry, al with different ways of saving their data and graphical attributes. So you'll need to cover all cases... And every year things get added/changed in VW, so maintening this will take some time too. I think it's best to contact VW inc for this, they might be able to tell you what other export menu commands do and tell you how to implement this correctly in a safe way. @Hugues @Vlado @SteveJ
  23. virtual void ForEachObject( short traverseWhat, GS_ForEachObjectProcPtr action, void *actionEnv) action is called for all object that match the traverseWhat criteria, you need to filter the type that you want in that function. actionEnv can be used to pass on any kind of data you want from your "main" function to this action function. Here's a rough example, this is how you could get a list of all lines in the drawing. struct SMyLineData { std::vector<MCObjectHandle> listLines; }; void ApplyCritIsLine( Handle h, CallBackPtr, void *data ) { SMyLineData* lineData = (SMyLineData*)data; if ( gSDK->GetObjectTypeN( h ) == kLineNode ) lineData->listLines.push_back( h ); } void foo() { // save all lines in the drawing in lineData.listLines SMyLineData lineData; gSDK->ForEachObject( allObjects | descendIntoAll, ApplyCritIsLine, &lineData ); // do something with that list. } However, instead of saving it in a list, you could also do your operation directly in your action function. For resources, like texture definitions, you need to use gSDK->BuildResourceListN() or any of the other resource list functions/classes. But I'm not 100% sure this is actually what you need, do you want to go through the list of all objects inside a container?
  24. Have a look at AutoIt (https://www.autoitscript.com/site/), we used to use it a lot to automate VW, all the things we couldn't do via VS or the SDK, we did with AutoIt (opening dialogs, filling in dialogs, clicking buttons, moving dialogs and palettes around, taking screenshots, importing and exporting etc). It's a very powerfull thing. However, I haven't used it in almost 10 years, mainly because we don't need it anymore, with the recent versions of VW we could do the things we needed to do via the SDK. So I'm not sure how well this program aged, the last version is from 2018... Anyway, with the "AutoIt Window Information Tool" you can get the name/ID of the dialogs/palettes. That ID can then be used to resize and reposition those dialogs/palettes. I did a quick test and this is how you can move and resize the Resource Browser: WinMove("Resource Manager", "", 100, 100, 800, 600) However, I couldn't find how to move the palettes around, so I think you need to do this with actual MouseClickDrag operations. And perhaps you can use the "recorder" for that. Just record the things you normally do and let AutoIt generate the code. Adjust it here and there and you should be good to go. However, I just checked and the recorder is not part of the installation anymore, but you can still find it here: https://www.autoitscript.com/forum/topic/176009-where-is-au3recordexe/
×
×
  • Create New...