TurboCAD Forums

The Ultimate Resource for TurboCAD Knowledge

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

Graphictype information
Read 4166 times
* August 14, 2014, 02:58:41 AM
I have used TC since version1 and am on V20 Plat.  (I am not a programmer but use VB in Excel, math software etc.)

Used many VB scripts in past to automate work but the TC model changed and most is not working in later versions of TC.  Currently Ruby is preferred and even this changed and scripts is not working in V20 as in V19.

Currently I am once again frustrated with the documentation of TC.

Can anyone help me with basic information to help me get going again on some scripts.

I would for a start know the following:
What graphictypes are available and how to use them.

How would I know that .add(11) add a new, empty polyline and for that matter a 3d one?
To help understand my question I refer to the sample script by Kevan Chapman to draw a 3d Polyline

# Written by Kevan Chapman for IMSIDesign, LLC.
# Script Version Jan. 28, 2013

def draw3DPolyline
   tcApp = TCApplication
   tcActDwg = tcApp.ActiveDrawing
   tcActVw = tcActDwg.ActiveView
   tcGrs = tcActDwg.Graphics
  tcGr = tcGrs.Add(11) #add a new, empty polyline
  grVerts = tcGr.Vertices
  types = 0
  grVerts.UseWorldCS = true
  grVerts.Add(12.5, 3.5, 0.0)
  grVerts.Add(12.5, 0.0, 0.0)
  grVerts.Add(24.5, 0.0, 0.0)
  grVerts.Add(24.5, 3.5, 0.0)
  grVerts.AddClose(true, true, true, true, true, false)

Does add.(11) always add a empty polyline?

Why does add(11,"TCW30Point") add a 3d point in the example from same author in TC20_ImportXYZPoints

#Create a new empty pointmark entity.
        tcGr = tcGrs.Add(11, "TCW30Point")

This cry for help is not for a lack of trying.  In the SDK documentation (IMSIGX.sch) one can find add options for various graphic types like: AddHatch, AddDimensionleader, .....Addsphere ... AddWedge but no 3dpolyline, etc.

It seems as if the general add method is this one:

Add(GraphicType As Variant, RegenMethod As Variant, Inherit As Variant, Style As Variant, Before As Variant, After As Variant) As IGraphic

The options for the Graphic type is no where defined.  Help with this would be appreciated.

A table with the graphic types, description, use method etc would be beneficial for all I think.  To include this in the SDK documentation would also be beneficial.

My immediate need is to insert a 3d spline by fit points calculated by Matlab or similar software.

Thanks in advance for your kind support.


* August 15, 2014, 02:37:21 AM
Hi All

I tried to get more info by doing the following:

Identified all the Graphic properties as listed on http://www3.turbocadcommunity.com/tiki-index.php?page=Graphic+object

Ripped the descriptions from actual properties in Excel, Wrote a VBA macro to generate the necessary Ruby code to run in Ruby console generating a file with the results.  The Ruby code for this is in part:

tcapp = TCApplication
   tcdrw = tcapp.ActiveDrawing
   tcgrx = tcdrw.Graphics
   grx_qty = tcgrx.count
   f.write("tcgrx.count = " + grx_qty.to_s+"\n" )
   tcgrx.each do
      | entity |
      f.write (entity.Application)
      f.write (entity.Attributes)

I then copied the Output file's content to Excel, ripped the unnecessary info out and generated a table with a macro and the following table is the result.

Note that I did this for the graphics as indicated in the header of the table.
The Referencepoint generated an error and was left out.

Even with this information I am still no closer to solving the problem than previously.

How do you create a 3DSplinebyFitPoints with Ruby in TC20 Plat?




* August 16, 2014, 12:46:08 PM
Hi Jacobusdt
I am not a programmer too,  but  I wrote some scripts for myself in VB 2010 and Ruby. My first encounter with TC was associated with version 6  :-). I came across it, as advertising on CD, in the magazine PC World (I do not know if it still exists and if I'm not sure if  the name is correct). Sometimes, I lost many hours trying to write something in Ruby for TC, based only on the SDK TC documentation for Visaul Basic. I found now for Curve Type = Spline two links. I tried both, but  for attempt  - snap 2,  I could not add the next points. For version snap1, I wrote a simple ruby script, which draws a spline. I do not know, if it will be something useful for you, but I attach the script (as txt). Maybe this will help you in your search.

def spline

   tcApp = TCApplication
   tcDrw = tcApp.ActiveDrawing
   tcView = tcDrw.ActiveView
   tcGrx = tcDrw.Graphics.Add(11, "TCW30Curve")
   verts = tcGrx.Vertices

verts.Add( 0, 0, 0)
verts.Add( 5, 10, 0)
verts.Add(10, 0, 0)
verts.Add(15, 10, 0)
verts.Add (20, 0, 0)

MessageBox.Show "Done"



TurboCAD Pro 2016, TurboCAD Pro 2018
Laptop Asus i7 6500U, dual-core 2,50GHz, NVIDIA GeForce GTX 950M, RAM 12 GB, SSD 480GB
Windows 10 64 bit

* August 18, 2014, 06:17:00 AM
Hi Marek

You are right, losing or wasting time is the name of the game when trying to automate something in TC.

Thanks for your reply.  In my efforts I also could generate this type but not a by point spline.  I can't see where to change something to get that.

My time for this is now about up.

But think the best way is to manually create the by fit points object and then try to see if I can edit the points and add more. To get the result.

CAn you provide me with a link to the info that you used or a reference? Thanks

It is a pity that the documentation is so poor, because it seems quite easy to do things once you know how to do it.

If the documentation and the examples could updated and an example for instance of all the type of graphics could be made showing the settings for this would make life much easier.

Howe long would it take to do such an example?  A couple of minutes, maybe a day at worse.  The examples by Chapman could not take him much more than 10 to 15 minutes to make.




* August 18, 2014, 08:32:53 AM
CAn you provide me with a link to the info that you used or a reference? Thanks
I have used here, documentation attached at Corner SDK / SDK Documentation / TCSDK Documentation Update - http://forums.turbocad.com/index.php/topic,2960.0.html


TurboCAD Pro 2016, TurboCAD Pro 2018
Laptop Asus i7 6500U, dual-core 2,50GHz, NVIDIA GeForce GTX 950M, RAM 12 GB, SSD 480GB
Windows 10 64 bit

* August 18, 2014, 11:40:08 AM
Have you looked at all the documentation on your computer, - in program files (or program files (x86)) / IMSIDesign / TCW20 / SDK / Docs - just a thought


* August 19, 2014, 02:02:02 AM
Hi Andy

Yes but it is quite useless.  For instance the SDK help provides the following for spline curve graphics:

Using Spline Curve Graphics (Regen)
   The TurboCAD Spline curve is a continous cubic spline, defined by a minimum of three control points.  Each Spline is defined by start and end points on the curve, and at least one intermediate control point.  All intermediate control points are off-curve points. Note: Even if you create a curve using the Spline By Fit Points command in TurboCAD, the result is a spline with control points.

The parent Spline curve graphic has two children: a DATA graphic that contains property information, and a cosmetic GRAPHIC that contains the approximating polyline to the curve.  The child cosmetic is just a simple 3D Polyline type.

Spline Curve Graphic Details Part Description
Type TCW30Curve
RegenType TCW30Curve
Normal Flags Editable, Visible
Subtype Extended Properties $SPLINESEGS: Integer; The number of segments in the spline approximation
$SPLFRAME: Integer; Indicates whether or not to show the spline frame
$SPLINETYPE: Integer; Type of curve -- 0 for a spline, 1 for a bezier curve
DEGREE: Long; Indicates the maximum degree of the curve.
SPLINECLOSED: Byte; Value: Indicates whether or not the curve is closed.
NPOINTS: Long; The number of points in the curve's control frame
NKNOTS: Long; The number of knots in the curve
REALDEGREE: Long; The actual degree of the curve
M_ObjectType: String; "Spline"

It then supply a demonstration of the code to utilise this as shown below:

Dim app As IMSIGX.Application Dim drw As IMSIGX.Drawing Dim grf As IMSIGX.Graphic Dim verts As IMSIGX.Vertices Dim props As IMSIGX.Properties Set app = GetObject("", "TurboCAD.Application") Set drw = app.Drawings.Add Set grf = drw.Graphics.Add("TCW30Curve", "TCW30Curve") Set verts = grf.Vertices Set props = grf.Properties
props.Item("$SPLFRAME").Value = 1
props.Item("$SPLINETYPE").Value = 1 'bezier'
verts.Add 0, 0, 0
verts.Add 5, 10, 0
verts.Add 10, 0, 0
verts.Add 15, 10, 0
verts.Add 20, 0, 0
Set grf = Nothing             
Set grf = drw.Graphics.Add("TCW30Curve", "TCW30Curve")
Set verts = grf.Vertices
Set props = grf.Properties
props.Item("DEGREE").Value = 4
props.Item("$SPLFRAME").Value = 0
props.Item("$SPLINETYPE").Value = 0 'spline' props.Item("SPLINECLOSED").Value = 0 'spline not closed.
verts.Add 0, 0, 0
verts.Add 5, 10, 0
verts.Add 10, 0, 0
verts.Add 15, 10, 0
verts.Add 20, 0, 0
 Dim grf2 As IMSIGX.Graphic Set grf2 = grf.Graphics.Item(1)  'Item(0) is the Data object, Item(1) contains the cosmetic graphic' Dim verts2 As IMSIGX.Vertices Set verts2 = grf2.Vertices Dim grf3 As IMSIGX.Graphic Set grf3 = drw.Graphics.Add 'default graphic type is polyline Dim verts3 As IMSIGX.Vertices Set verts3 = grf3.Vertices Dim vx As IMSIGX.Vertex For each vx in verts2 verts3.Add vx.x, vx.y, vx.z 'copy the cosmetic vertices to the new polyline Next grf3.Properties.Item("Pencolor").Value = 255 grf3.Draw
You cannot convert this to Ruby as the properties names are unknown and produce an immediate error.
I went back to Excel and VBA to check if it could work and yes you can get this working, to an extend.  When you try to access item 1 an error occur.
Further more this can not be used to draw a 3D curve as I can only generate a 2d version of graphs even if the z coordinate is not 0.
If you can help me to figure out how to achieve this I will greatly appreciate it.  Ryby is seems to be very dead.
Thanks anyway for your input.