ISection2.Detach() not working

Forum for reporting problems
Post Reply
Ibi
Posts: 19
Joined: Mon Jul 29, 2013 12:44 am

ISection2.Detach() not working

Post by Ibi »

Hi
I have tried to move/rotate object by detaching it. For some reason when I use detach function of Isection2, the detached object, instead of appearing as the last top level object, it actually get deleted. I don’t know if I am doing anything wrong, just wanted to check if anybody else reported it.
Thank you
Ibi

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

Re: ISection2.Detach() not working

Post by nickz »

Hi Ibi
The documentation was wrong. The detached section remains standalone. It will be alive for any operations until you release the last reference to it

You can add it to the model using IModel2.Add() as below.

Thank you for reporting. We did not realise it was never used in samples.

Private Sub OnDetach(sender As Object, e As EventArgs) Handles buttonDetach.Click
Dim iMod As IModel = AxKernCADnet1.GetModel
Dim iSectCone As ISection = iMod.GetSection(1)
Dim iSectSphere As ISection = iSectCone.GetChild(0)
Dim iSect2Sphere As ISection2 = iSectSphere
iSect2Sphere.Detach()

Dim iMod2 As IModel2 = iMod
iMod2.Add(iSect2Sphere)
End Sub

Regards

Post Reply