RenderSolid in 7.2

Everything DG Kernel: Technical discussions and issues
Post Reply
Measure
Posts: 10
Joined: Wed Oct 23, 2024 1:54 pm

RenderSolid in 7.2

Post by Measure »

Hello,

I'm working with 32bit VB6 and the KerCADe.ocx version (5549 I believe).

We have a button to swap between solid render and wireframe.

Previously we would use the KerCADcontrol.RenderSolid boolean, however this now gives an error.

I see there is a GetRenderSolid and SetRenderSolid in IControlInitialisationContext_DG. So far, I've been unable to properly initialize a IControlInitialisationContext_DG variable, not seeing any good way to generate it or derive it from the other class/structs...

Any tips for us?
Prashant Kande
Posts: 86
Joined: Tue Jun 18, 2024 6:12 am

Re: RenderSolid in 7.2

Post by Prashant Kande »

Hi
Sorry about that. We are looking into it.
Thanks for reporting.
Prashant Kande
Posts: 86
Joined: Tue Jun 18, 2024 6:12 am

Re: RenderSolid in 7.2

Post by Prashant Kande »

I do not see it happening
RenderSolid should work. It is a very basic core functionality.

I have tried few v5.2 VB6 samples with 5553 and 5552. It seems to be OK.
5549 seems to have some build problem. Try the current 5553 please or an earlier update.

Regards
Prashant Kande
Posts: 86
Joined: Tue Jun 18, 2024 6:12 am

Re: RenderSolid in 7.2

Post by Prashant Kande »

The most common way to define control properties (ModelPath, etc.) is using the designer. They can also be set at runtime. ControlInitialisationContext_DG is yet another, somewhat exotic in my view, way to of defining the properties. It was intended for the case when the control and/or the form are created programmatically at runtime, so there is no designer involved.

This is an overview: Initialisation Context (ActiveX), Initialisation Context (.NET)

C++ version of Shape Explore sample has an example.
Measure
Posts: 10
Joined: Wed Oct 23, 2024 1:54 pm

Re: RenderSolid in 7.2

Post by Measure »

Hi Prashant,

I am running v5555 now.

I am still having an issue calling RenderSolid = false when I have created a Mesh geometry in DG.

First, I load an IGES file. Then, from the IGES, we make a mesh using the following lines:

Note: IGES geometry is loaded into MyComponentEntity (As IEntity_DG)
MyModel3D (as IModel_DG) is derived from KernelCAD.GetModel

Code: Select all

    'Mesh generation for sharper visualization
    Dim blnAddMesh As Boolean, dblMeshResolution As Double, MyDictionary As IDictionary_DG
    blnAddMesh = True
    If blnAddMesh = True Then
         'Set mesh resolution for appropriate visualization (KernelCAD range 0.001-1000)
        dblMeshResolution = 0.1
        Set MyDictionary = MyObjGen3D.Create("IDictionary_DG")
        Call MyDictionary.SetDouble("Deviation", dblMeshResolution)
        Call MyComponentEntity.SetGeometryTypeEx("Mesh", MyDictionary)
    End If
        
    ' STEP 6 - add to main model and render
     Call MyModel3D.AddEntity(MyComponentEntity)
When I call RenderSolid = true, no issues.|
When I call RenderSolid = false, I get object disconnect errors and the IDE crashes along with the program.

I can share a driver project with you privately if needed.

-Adam
Prashant Kande
Posts: 86
Joined: Tue Jun 18, 2024 6:12 am

Re: RenderSolid in 7.2

Post by Prashant Kande »

What works well is a small runnable test/demo similar to this. Try a simplest case first. Create an iges using a sample like DIView. In the Model Explorer delete all objects, create a box or rectangle (or IStdShape_DG.Rectangle() or Box()), save as iges. Create a new small app or modify a sample.

It serves as a proof, analysis, problem reduction, preliminary step for debugging, etc.

Cheers
Prashant Kande
Posts: 86
Joined: Tue Jun 18, 2024 6:12 am

Re: RenderSolid in 7.2

Post by Prashant Kande »

I have added

Code: Select all

public void RenderSolid_ForumT116()
{
    base.Load("IGES\\Lens.iges");

    int n = m_iModel.GetEntityCount();              Debug.Assert(n > 0);
    IEntity_DG entity = m_iModel.GetEntityAt(0);
    IEntity_DG entityNew = entity.Clone();

    IDictionary_DG iDict = m_gen.Create<IDictionary_DG>();
    iDict.SetDouble("Deviation", 0.1);

    entityNew.SetGeometryTypeEx("Mesh", iDict);
    m_iModel.AddEntity(entityNew);

    m_dgkc.RenderSolid = true;
    m_dgkc.RenderSolid = false;

    m_iView.Reset(true, true);
}
to the IViewTest of the InterfaceTests.

In the base:

Code: Select all

// pathLocal must be relative to the installed Models folder
public bool Load(string pathLocal)
{
    string modelsFolder = RegistryDg.GetInstallationPath() + "Models\\";
    string pathFull = Path.Combine(modelsFolder, pathLocal);
    return m_iModel.Load(pathFull);
}
I do not get the problem.
TestWE7736.png
TestWE7736.png (46.9 KiB) Viewed 92798 times
Notice that SetGeometryTypeEx() modifies the entity in place. So, I do Clone() before that. The model explorer shows the initial structure and the new entity OK.
Post Reply