Page 1 of 1
DG7.1 and rendering facets in Imesh_DG
Posted: Fri Jun 02, 2023 7:41 pm
by arg25
Hello,
I am following the VBnet tutorials for the ActiveX control version of 7.1 (latest release).
I am having trouble recreating the Morph sample, rendering individual facets and vertexes.
I am having issues specifically with the iMesh_DG structure and the usage of methods/functions AddVertex() and AddSimplex(args).
"Function or Interface marked as Restricted, or the function uses an Automation Type not supported in Visual Basic".
The same error also occurs on calls with IList_DG structure to GetHeadPosition.
Anyone have any examples for the 7.1 in VB6 or suggested work arounds?
-Adam
Re: DG7.1 and rendering facets in Imesh_DG
Posted: Thu Aug 03, 2023 3:08 pm
by arg25
Hello, I am still having this issue...
I can't seem to add vertices to my mesh with vb6... the call to iMesh.AddVertex just gives me "Function or Interface marked as Restricted, or the function uses an Automation Type not supported in Visual Basic".
Any help you can provide?
Dim m_gen As IObjectGenerator_DG
Set m_gen = IModel 'initiate the context for the generator
Dim iMesh As IMesh_DG 'Standalone mesh instance from object generator
Set iMesh = m_gen.Create("IMesh_DG")
iMesh.AddVertex
Re: DG7.1 and rendering facets in Imesh_DG
Posted: Fri Aug 04, 2023 3:13 pm
by arg25
I've found some samples in the 5.1 version for Vb6 that pointed me to the iMeshMods and iMeshTopol to access the vertex and simplex of the IMesh class.
So this is working well for small files under say, 25mb, but beyond that I begin to get memory errors and crashes.
Here is my current approach, any comments or suggestions would be really helpful to me...
Code: Select all
Dim IModel As IModel_DG
Set IModel = KernelCAD1.GetModel
'Model generator
Dim iGenerator As IObjectGenerator_DG
Set iGenerator = IModel
'dictionary to change type to mesh
Dim params As IDictionary_DG
Set params = iGenerator.Create("IDictionary_DG")
Call params.SetString("Type", "Mesh")
Dim iGeom As IGeometry_DG
Set iGeom = iGenerator.Create2("IGeometry_DG", params)
Dim iMeshObject As IMesh_DG
Set iMeshObject = iGeom
' Allocates vertex data and creates facets for mesh
Dim iMeshTopol As iMeshTopol
Set iMeshTopol = iMeshObject
' Sets vertex positions
Dim iMeshMod As IMeshMods
Set iMeshMod = iMeshObject
iMeshObject.Begin 'allows you to add data without refreshing after each line
'Get position of the first vertex
Dim v(0 To 2) As Long
v(0) = iMeshTopol.AddVertex
v(1) = iMeshTopol.AddVertex
v(2) = iMeshTopol.AddVertex
iMeshMod.SetVertexCoord v(0), 0, 0, 0
iMeshMod.SetVertexCoord v(1), 1, 1, 1
iMeshMod.SetVertexCoord v(2), 0, 2, 3
'Add the facet
Call iMeshTopol.AddSimplex(v(0), v(1), v(2), 0)
iMeshObject.End (eMeshModsActionNormalsAuto) 'calculates all normals after
Dim iEntity As IEntity_DG
Set iEntity = IModel.AddNewEntity
iEntity.AttachGeometry iGeom
' UpdateDisplay
Me.KernelCAD1.UpdateView
'access IView_DG, which is the root of the view-related functionality
Dim iView As IView_DG
Set iView = KernelCAD1.GetView()
'refits the view to include the new object.
Call iView.Reset(True, True)