Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I tested Inventor API vs. ObjectDBX. The ObjectDBX 10 times faster.
I understand that these lines of different objects.
When measure by use CPU ticks, and DeferUpdate=True, I see that Inventor API increases productivity by 30%
But 30% is not "much faster". ObjectDBX really "much faster".![]()
Is there a the Inventor API capacity for productivity? Or its limit?
Do selected the entity of ObjectDBX impossible?
I attached sample for external VB.NET:
Sub Main()
Dim InvApp As Application = GetInventorApplication()
Dim sw As Stopwatch = New Stopwatch
sw.Start()
TestInventorLines(InvApp)
sw.Stop()
Dim TicsInv As Int64 = sw.ElapsedTicks
Console.WriteLine("Inventor API Ticks: {0}", TicsInv)
sw.Reset()
sw.Start()
TestAcadLines(InvApp)
sw.Stop()
Dim TicsAcad As Int64 = sw.ElapsedTicks
Console.WriteLine("Acad ObjectDBX Ticks: {0}", TicsAcad)
Console.WriteLine("{0} times the difference", TicsInv / TicsAcad)
Console.ReadKey()
End Sub
Sub TestInventorLines(ThisApplication As Application)
Dim tg As TransientGeometry : tg = ThisApplication.TransientGeometry
Dim draw As DrawingDocument : draw = ThisApplication.ActiveDocument
Dim s As DrawingSketch : s = draw.ActiveSheet.Sketches.Add()
ThisApplication.ScreenUpdating = Not ThisApplication.ScreenUpdating
s.Edit()
s.DeferUpdates = True
For i = 0 To 500
Dim p1 As Point2d : p1 = tg.CreatePoint2d(0, i * 0.05)
Dim p2 As Point2d : p2 = tg.CreatePoint2d(10, i * 0.05)
Call s.SketchLines.AddByTwoPoints(p1, p2)
Next
s.ExitEdit()
s.DeferUpdates = False
ThisApplication.ScreenUpdating = True
draw.Update()
End Sub
Sub TestAcadLines(ThisApplication As Application)
Dim draw As DrawingDocument : draw = ThisApplication.ActiveDocument
Dim ad As AXDBLib.AcadDatabase : ad = draw.ContainingDWGDocument
For i = 0 To 500
Dim startPoint(0 To 2) As Double
Dim endPoint(0 To 2) As Double
' Define the start and end points for the line
startPoint(0) = 10 : startPoint(1) = i * 0.05 : startPoint(2) = 0
endPoint(0) = 15 : endPoint(1) = i * 0.05 : endPoint(2) = 0
Call ad.PaperSpace.AddLine(startPoint, endPoint)
Next
draw.Update()
End Sub
'Функция получения ссылки на Inventor
Function GetInventorApplication() As Application
Dim InvApp As Application
Try
'Попытка присоединится к загруженному в память Inventor
InvApp = CType(Marshal.GetActiveObject("Inventor.Application"), Application)
Catch ex As Exception
'Загрузка Inventor в память и присоединение к нему
Dim InvType As Type = Type.GetTypeFromProgID("Inventor.Application")
InvApp = CType(Activator.CreateInstance(InvType), Application)
InvApp.Visible = True
End Try
Return InvApp
End Function
Solved! Go to Solution.
