Resetting Transforms

Technical discussions
Post Reply
Claude
Posts: 23
Joined: Thu Jan 05, 2017 3:58 am

Resetting Transforms

Post by Claude »

Good day,
Sorry - some more questions ;-((

When I create the sections in the model, for each section I create the Vertices with coordinates in the ref. frame tied to either the Pinion or Gear.

These then have to be located in the General ref. frame: Rotation of the Pitch angle and translation of the origin of the Pinion or Gear ref. frame in the General ref. frame.

I use I3DObj for this as follows:

Code: Select all

            ' Move it
            '
            Dim i3DObj  As I3DObject  = iSection 
            i3DObj.Rotate(Angl2, 0, 0, 0, 0, 1, 0)
            i3DObj.Translate(Dist1, Dist2, Dist3)
where Angl2 is the Pitch cone angle, Dist1, Dist2 and Dist3 are the coordinates of the origin of the Pinion ref. frame in the General ref. frame.

All this is fine the 1st time I use it.

Now let's say that I make a modification to the pinion geometry and I have to recreate the complete Model because the coordinates have changed.

I first delete all that is related to the Model, as follows:

Code: Select all

         Dim iModel2       As IModel2
         Dim iArray        As IArray
         ' Primary Model
         '
         iModel2     =  AxKeyCad.GetModel()
         iArray  = DirectCast(iModel2, IArray)

         If Not iArray Is Nothing Then 
            iArray.RemoveAll()
         End If

         If Not iModel2 Is Nothing Then 
            iModel2.RemoveAll()
         End If
Then, I simply go through the same steps to re-create the model, but somehow, the Transforms have not been reset and now the Pinion appears in an impossible location.

Question: How can I reset the transforms after applying them ?

Thanks, Claude

nickz
Site Admin
Posts: 236
Joined: Fri Jul 26, 2013 3:58 am

Re: Resetting Transforms

Post by nickz »

Sorry for the late answer, Claude

It sounds strange. This is solid functionality. I am sure it is a bug on your side. You need to debug. It could be recreation procedure remembers old numbers or applies the transformation several times

The transformation is stored only in the section. Neither parent, nor model, nor KC knows about it. May be you are keeping references to sections and reusing them? If you keep reference to a section and delete everything from the model the section is still alive and can be added back

Think about tracing debug info about section locations. You can add something like TraceSection(iSection), where you query location and orientation and print into the output window

Try debugging on a simplest case like transformation along x by 1.0 and no rotation.

You can check location in model explorer. You can also dump sections and model into 3DDebugger while debugging. See the 3DBugger sample

Nick

Post Reply