TurboCAD Forums

The Ultimate Resource for TurboCAD Knowledge

Register
 
The purpose of these forums is to discuss TurboCAD.  Please keep the discussion of other products to compatibility issues or how the other software’s can be used with TurboCAD.


VB 2010 Tool example to add multiple solids (TC 19)
Read 6163 times
* July 12, 2012, 07:42:44 PM
The attached Visual Basic 2010 sample project creates a menu entry (Tools/DotNet Tools/VBDotNet MultiAdd) and a single-tool toolbar. The tool adds two or more solids together (but doesn't handle part-tree solids), and has an Undo feature.

The project is currently configured for the 64-bit version of TurboCAD 19 -- to switch to 32-bit change the Build Configuration to Any CPU or to x86. You'll have to manually copy the resulting dll to your TurboCAD's Program/Draggers folder. (For some reason I couldn't get the Post-Build event to copy successfully).

The project currently assumes that it is located in your SDK\Samples\VB Net\tool folder --- if you locate it somewhere else the relative paths to IMSIGXMGD.dll and TCDotNetInterfaces.dll will be wrong, and you'll have to manually remove and re-add those references. I suggest saving the zip file directly to your TC 19 installation's SDK\Samples\VB Net\tool folder, then using the "extract here" option of Winzip or 7Zip.

Troubleshooting:
"I get a lot of errors about missing references when I try to compile it".
Make sure that IMSIGXMGD.dll and TCDotNetInterfaces.dll are referenced correctly. Check their properties and be sure they are pointing to the correct folder for your installation of TurboCAD 19 (or later). Try removing and re-adding those two references via the "browse" tab of Add Reference (be sure to add them from the correct version of TurboCAD!).
Also make sure you are targeting the DotNet 4.0 framework -- 3.5 or older just won't work, sorry.

"It compiled with no errors, but I don't see the toolbar or menu entry when I start TurboCAD".
Make sure you have your Build Configuration set for x64 (or, if you want a 32-bit version, set it for x86 or AnyCPU).
Make sure you have copied the dll to the Program/Draggers folder of your TurboCAD installation.

Enjoy!
Kevan

Logged


* July 14, 2012, 03:40:11 AM
#1
Hi Kevan
thank you sooo much!!!!
That works fine here.

best regards
Bernd

Logged


* July 15, 2012, 08:33:52 PM
#2
Great! Glad to hear it.

Logged


October 25, 2012, 08:25:41 AM
#3
I downloaded the MultiAdd zip file and extracted the contents to one of my programming directories.  A little different but I then opened the VBPROJ file in the new VB 2012 Express (using Net 4.5).  I corrected the references IMSIGXMGD.dll and TCDotNetInterfaces.dll to c:\program file\IMSIDesign/TCW19P/program and then built it in VB Express.

I then copied the MultiAdd_VBNet.dll from E:\data\programmes\MultiAdd_VBNet\obj\x64\Release to the program/draggers directory.  I ran TC19 and tried to access the MultiAdd to see what it did as a starting guideline to attempting my own AddIns but is is disabled as in the attached screen capture.

Any idea what I did wrong?

Logged
regards
Colin Reid
TC2017 Pro Platinum 64 bit  + LW plugin on Win10 desktop and  Quad Intel i7 with 32GB RAM + 128GB  SSD and 2TB partitioned hard disk, NVidia 2GB video


October 25, 2012, 08:44:09 AM
#4
I downloaded the MultiAdd zip file and extracted the contents to one of my programming directories.  A little different but I then opened the VBPROJ file in the new VB 2012 Express (using Net 4.5).  I corrected the references IMSIGXMGD.dll and TCDotNetInterfaces.dll to c:\program file\IMSIDesign/TCW19P/program and then built it in VB Express.

I then copied the MultiAdd_VBNet.dll from E:\data\programmes\MultiAdd_VBNet\obj\x64\Release to the program/draggers directory.  I ran TC19 and tried to access the MultiAdd to see what it did as a starting guideline to attempting my own AddIns but is is disabled as in the attached screen capture.

Any idea what I did wrong?

Hi Colin,

V19 already comes with the MultiAdd tool, but it has the wrong tool icon.


October 26, 2012, 04:17:06 AM
#5
Thanks Don but the only reason for using KChapman's examples was to learn how to write tools for TC in Visual Basic Net (defacto VB standard for 10 years and quite different to VB6) not the multiadd tool.

Great to see you this far down the forums.

Logged
regards
Colin Reid
TC2017 Pro Platinum 64 bit  + LW plugin on Win10 desktop and  Quad Intel i7 with 32GB RAM + 128GB  SSD and 2TB partitioned hard disk, NVidia 2GB video


* October 27, 2012, 12:15:52 AM
#6
Hi Colin
did you notice the advise from Kevan Chapman:
>>The project currently assumes that it is located in your SDK\Samples\VB Net\tool folder --- if you locate it somewhere else the relative paths to IMSIGXMGD.dll and TCDotNetInterfaces.dll will be wrong, and you'll have to manually remove and re-add those references.<<
I remember that it works only this way.
best regards
Bernd

Logged


October 27, 2012, 08:54:48 AM
#7
Bernd.  Thanks but I fear you have complicated matters.  Kevin (post of june 29 says to unpack the zip to c:/program ..../SDK/samples/DotNet/Base_x64_revised but you seem to say c:/...../SDK/samples/VB Net/tools.?
In every one of the attempts I have made, the answer is always when I open TC19, any entry in the Tools/DotNet tools menu item is shown as disabled.
My last attempt was as follows
i downloaded Kevin's ZIP file to my download directory and copied it to SDK/samples/Dotnet and unpacked it to a new subdirectory of dotnet called Base_64_revised/VBToolsample.  Drilling down there to the VBToolsample sudirectory and opened VBToolSample.vbproj in VB 2012 Express.  I then got the references for that project and corrected the IMSIGXMGD.dll and TCDotInterfaces.dll to the C:/program files/program subdirectory which cleared all the errror messages.  I then built the project and copied the VBToolSample.vbproj from /bin/release to c:/    /program/draggers.
  It is complicated but the same thing happens when I try Kevin's post of July 12th for MultiAdd VBNet example.
Can you see my error as you have clearly solved the problem?

Logged
regards
Colin Reid
TC2017 Pro Platinum 64 bit  + LW plugin on Win10 desktop and  Quad Intel i7 with 32GB RAM + 128GB  SSD and 2TB partitioned hard disk, NVidia 2GB video


* January 05, 2013, 12:09:12 AM
#8
Colin, sorry for the late reply but this just occurred to me. Do you have anything selected? The tool won't enable if nothing is selected (select the objects to be added first).

Kevan

Logged


January 05, 2013, 06:21:51 AM
#9
I am not sure what you mean by do I have anything selected. 

I am trying to understand how to presumably add buttons and how to attach code to that.  The first example in mind is to copy an object or series of shapes from one drawing to another.  It would also record the PosX, PosY and PosZ and alter the same after posting in the new drawing.  The VB coding is not a problem once I get the hang of specific TurboCad instructions.

Are the actions described in my 27 Oct post correct?

Logged
regards
Colin Reid
TC2017 Pro Platinum 64 bit  + LW plugin on Win10 desktop and  Quad Intel i7 with 32GB RAM + 128GB  SSD and 2TB partitioned hard disk, NVidia 2GB video


* January 23, 2013, 01:28:11 PM
#10
I meant, did you have anything selected in the drawing? The tool requires something to be selected before it will even "activate". If nothing is selected, it will appear "grayed out" in the menu. If it appeared in the menu at all, you've almost certainly compiled it correctly. To use it, you select two or more solids, then run the tool.

See the code in the UpdateToolStatus function for the enable/disable logic.

Kevan
« Last Edit: January 23, 2013, 01:31:54 PM by kchapman »

Logged


January 24, 2013, 05:34:51 AM
#11
Now I understand.  Thanks.

Do you know of any reference work explaining how to make calls to the 2 Dlls to start me off on the process of writing my own projects if the samples supplied by IMSI do not work very well (your post of 29 June 2012?

Logged
regards
Colin Reid
TC2017 Pro Platinum 64 bit  + LW plugin on Win10 desktop and  Quad Intel i7 with 32GB RAM + 128GB  SSD and 2TB partitioned hard disk, NVidia 2GB video


* January 24, 2013, 08:41:59 AM
#12
The process more or less boils down to this:

Start a new VB2010 "Class Library" project.

Add references (you'll have to use the Browse option) to IMSIGXMGD.dll and TCDotNetInterfaces.dll

In your class definition, type:
Implements TCDotNetInterfaces.ITurboCADTool
When you complete the line and press Enter, it will stub in all the tool functions and properties you need. From there, use my examples as a guideline.

Be sure to target the correct processer -- use x64 specifically for 64-bit TurboCAD; you may use x86 or AnyCpu for 32-bit TurboCAD tools.

Once your dll is created, be sure to copy it to your TurboCAD's Program/Draggers folder.

For your tool to properly interface with TurboCAD, it needs to use the format I have followed in the examples, i.e.:

It needs a Description property (readonly).

It needs to fill out the ToolInfo fields in the GetToolInfo function.

It needs an Initialize function. This may be as simple as "Return True", or could get more complex, depending on your tool.

It needs a Run function. This is what happens when the user starts your tool.

It needs a Terminate function. Usually a simple "Return True" will suffice, but you may need to do extra clean up, depending on how your tool works.

It needs an UpdateStatus function. As pointed out below, this is where I enable  or disable the MultiAdd tool, based on whether or not anything is selected. If your tool has no entry requirements, a simple "Enabled = True ->Return True" should suffice.

Some very light descriptions of the SDK functions are available in the SDK/Docs folder of your TurboCAD installation.

I hope that helps a bit.

Logged


January 25, 2013, 06:03:43 AM
#13
Thanks for the pointers.  Now the fun begins

Logged
regards
Colin Reid
TC2017 Pro Platinum 64 bit  + LW plugin on Win10 desktop and  Quad Intel i7 with 32GB RAM + 128GB  SSD and 2TB partitioned hard disk, NVidia 2GB video