TurboCAD Forums

The Ultimate Resource for TurboCAD Knowledge

Register
 
Interested in some really terrific mobile apps? Visit www.turboapps.com for details.

3D Objects from SDK?
Read 8631 times
* May 26, 2011, 10:48:57 AM
I really appreciate the help on the forum.

I have data that I would like to visualise in TurboCad.  The data has the form u = f(x,y,z).

The variables x, y and z are utilised by Excel solver to generate the result u.

I would like to display u as sphere of size u at the coordinates x,y,z.

For example.  At x=200, y=100 and z=50, the value of u=32.5 (Calculated).  I would like to use VBA in Excel to add a sphere with radius 16.25 (32/2) at position (200,100,50) and continue with the rest of the values.  I calculated many values and there is just no way to manually do the visualisation to determine the sound opperting areas.  At least I hope it would not be necessary.

If I can add the spheres by means of a VBA program it will help greatly.
I cant find in the SDK or the Object browser any information that can help me.

A further help would be to actually colour code the spheres based on their size.  This will give me a double visualisation effect - size and colour.

I will define a function to convert the size to a suitable RGB value to be used.

Hope you can help once again.

Thanks
Jacobus dt

Logged


* June 01, 2011, 12:00:30 PM
#1
This isn't a VBA tool, just a VBS script, but it should point you in the right direction.

Logged


* June 29, 2011, 11:27:20 PM
#2
Thanks KChapman for the information.

I was out of the office and country for some time, sorry for the late response.

I would like to ask a question though.  How on earth do you how to do it?

I looked in the object browser and found nothing on spheres.  After receiving your demo I could see that you used the .add thing but according to the object browser the syntax should be:

Function Add([GraphicType], [RegenMethod], [Inherit], [Style], [Before], [After]) As Graphic

You used:Set TCSphere = TCDraw.Graphics.Add(, "TCW40SPHERE")

Why the first , and then the graphic type? 

Where did you find the properties of the sphere graphic type?  I looked in the object browser and found not even a reference to sphere and the SDK is also silent on this.

Is there somewhere else to look apart from the object browser and the SDK to find the hidden information?

How did you know about the hemisphere setting - 0 for full and I assume 1 for semi?
What is the meridia...  When I add the TCSphere to the watch and open the variable, I do not find these under the Properties of the TCSsphere.

Sorry if I ask questions which is trivial for most but I would like to understand how to get information on the programming of TCad.

Thanks


Logged


* April 24, 2012, 06:08:26 PM
#3
Hello Kevin, I am trying to find my way around delphi syntax again after many years, and cannot find any relevant code examples, so have tried to convert the the vbs script above to create a sphere in Turbocad V18.

Here is some of my interpretation with a lot of assumptions, some of the code in the example may also not be needed. I just need to get one good working example to get me started.

I am using Delphi XE2 starter.

Any Help Appreciated!.

Mike Geraghty.


procedure TForm1.Button5Click(Sender: TObject);
 var
TCApp: IMSIGX_TLB.IApplication;
TCDraw:  IMSIGX_TLB.IDrawing;
TCSphere: IMSIGX_TLB.Graphic;
TCSphereProps:  IMSIGX_TLB.Properties;
 Verts:  IMSIGX_TLB.Vertices;
  {FileName: variant;}
begin
 TCApp := GetActiveOleObject('TurboCAD.Application') as IApplication;
 TCApp.Visible := True;
 TCDraw := TCapp.Drawings.Add('');
 TCSphere := TCDraw.Graphics.Add('TCW40SPHERE',1,0,45,67,0);{ Runs upto here, then says array index out of bounds}
 TCSphereProps := TCSphere.Properties;
 Verts := TCSphere.Vertices;
 Verts.UseWorldCS := True;
 Verts.Add(200,100,50,1,1,1,1,1,0,0,0);
 Verts.Add(216.25,100,50,1,1,1,1,1,0,0,0);
 TCSphere.Draw('');

TCSphereProps := nil;
 TCSphere := nil;
 Verts := nil;
 TCDraw := nil;
 TCApp := nil;
end;




Logged


* April 27, 2012, 08:50:52 PM
#4
I have lost the plot here with delphi syntax after many years not doing any programming, so can anyone give me an example of drawing a sphere in delphi with the sdk as the example above, which is totally wrong somewhere, as I have added properties in and I am just guessing.

Any Help Appreciated.

Logged


* April 28, 2012, 12:30:50 AM
#5
Hello Michael,

didn't do anything with delphi for years, but when i look at the code, it seems that the pascal compiler treats
the 5 numbers of the arguments as the vertexes of two points - first the center of the sphere and second one point on the sphere - and so one z vertex is missing.


hope this helps

mike

here some links and a zip file
http://www.bcitool.com/TCDRC/Files/IMSI/Delphi/Regens/RRect.zip
http://www.bcitool.com/TCDRC/Files/IMSI/Delphi/Tools/InetTool.zip






Logged


* April 28, 2012, 12:47:56 AM
#6
Many thanks for the example and links Mike, I noticed some of the links are from the old forum, wish we still had that knowledge base, a real goldmine of information.

I have been up all night , so will have a look at your example and links later, and hopefully something will click in this tired old number filled brain.

Incidentally Mike, I have just started a thread for a "Turbocad SDK Programmers List"

If you would like to add your name, and languages of interest.

Here is the thread link below:-

"Turbocad SDK Programmers List" Thread Link :-

http://forums.turbocad.com/index.php/topic,9064.0.html
« Last Edit: April 28, 2012, 09:10:31 AM by Michael Geraghty »

Logged


* May 09, 2012, 04:14:58 PM
#7
Check the Delphi samples, Mike. I've created a sample project for Delphi XE2 that draws several different primitives. That ought to get you well on your way. Also look at the Delphi XE2 version of the Flange app.

Logged


* June 19, 2016, 08:32:05 AM
#8
Thanks KChapman for the information.

I was out of the office and country for some time, sorry for the late response.

I would like to ask a question though.  How on earth do you how to do it?

I looked in the object browser and found nothing on spheres.  After receiving your demo I could see that you used the .add thing but according to the object browser the syntax should be:

Function Add([GraphicType], [RegenMethod], [Inherit], [Style], [Before], [After]) As Graphic

You used:Set TCSphere = TCDraw.Graphics.Add(, "TCW40SPHERE")

Why the first , and then the graphic type? 

Where did you find the properties of the sphere graphic type?  I looked in the object browser and found not even a reference to sphere and the SDK is also silent on this.

Is there somewhere else to look apart from the object browser and the SDK to find the hidden information?

How did you know about the hemisphere setting - 0 for full and I assume 1 for semi?
What is the meridia...  When I add the TCSphere to the watch and open the variable, I do not find these under the Properties of the TCSsphere.

Sorry if I ask questions which is trivial for most but I would like to understand how to get information on the programming of TCad.

Thanks


 I was wondering the same things. I found the names in two places: in "tchj.dll" and in a file I "Saved As" version 6.5.
I had to view them both in a hex editor. Here are all of the names I found:
TCW70MESH
TCW70Region
TCLight
TCCamera
TCW60Wall
TCW60ACISSOLID
TC_Multiline
TCW50Polyline
TCW50IntProp
TCW40TEXT
TCW25DimLead
TCW25DimDat
TCW25DimRad
TCW25DimDia
TCW25DimAng
TCW25DimLin
TCW40LOFT
TCW40EXTRUDE
TCW40SPIN
TCW40CUBE
TCW40SPHERE
TCW30POINT
TCW30CURVE
TCW25Brush
TCW25DblLine

Alvin
« Last Edit: June 19, 2016, 09:11:17 AM by AlvinChipmunk »

Logged
Using TurboCAD v7 Pro