News:

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

Main Menu

VB Net 2010 64-bit - setting Z vertex to zero

Started by ibruethsch, July 14, 2012, 02:16:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ibruethsch

Hello
I used the code from Kevan as a template.
http://forums.turbocad.com/index.php/topic,9564.0.html
and changed the code.
Example to put the z-vertex to zero. (I need this tool when exchanging drawings to autocad.dwg (autocad LT - 2D))
10000 items : result

wow - these .dll are really fast.
code as .exe appr. 3 minutes
code as .dll less then 1 sec.

I did the following steps :
open Kevans
MultiAdd_VBNet in VS2010 Express
save it as a template
new project using the template

code
========================================
   Public Function Run(Context As IMSIGX.Tool) As Boolean Implements TCDotNetInterfaces.ITurboCADTool.Run
       'System.Windows.Forms.MessageBox.Show("Run My Simple VB tool")
       'Return True


       System.Windows.Forms.MessageBox.Show("setze Z-vertex auf 0")
       Dim tcapp As IMSIGX.Application
       tcapp = Context.Application
       Dim actdr As IMSIGX.Drawing
       actdr = tcapp.ActiveDrawing
       Dim gr As IMSIGX.Graphic
       gr = actdr.Selection.Item(0)


       For i As Integer = 0 To (actdr.Selection.Count - 1)

           gr = actdr.Selection.Item(i)
           gr.Vertices.UseWorldCS = True


           For j As Integer = 0 To (gr.Vertices.Count - 1)

               gr.Vertices(j).Z = 0


           Next j
       Next i

       tcapp.ActiveDrawing.ActiveView.Refresh()

       Return True

   End Function

   Public Sub Terminate(ByVal Context As IMSIGX.Tool) Implements TCDotNetInterfaces.ITurboCADTool.Terminate

   End Sub

   Public Function UpdateToolStatus(ByVal Context As IMSIGX.Tool, ByRef Enabled As Boolean, ByRef Checked As Boolean) As Boolean Implements TCDotNetInterfaces.ITurboCADTool.UpdateToolStatus
       Return True
   End Function
======================================


and did some changes:
a unique ID
       ToolInfo.InternalCommand = "CMD_10A969BD_2342_42FF_807D_44C54DFBBACF"
and in
AssemblyInfo.vb
a unique GUID
<Assembly: Guid("db19f390-6807-4e17-b4ff-63916f58290b")>


-----------------------------------------
remark:
when building an .exe I had success with a code starting with

       Dim tcapp As New IMSIGX.Application
       Dim actdr As IMSIGX.Drawing
       actdr = tcapp.ActiveDrawing
       Dim gr As IMSIGX.Graphic

but here I had to change it to

       Dim tcapp As IMSIGX.Application
       tcapp = Context.Application
       Dim actdr As IMSIGX.Drawing
       actdr = tcapp.ActiveDrawing
       Dim gr As IMSIGX.Graphic
--------------------------------------------------------

Its great to have the opportunity to build fast .dll now on X64.
Thanks again to Kevan.

best regards
Bernd