Hello,
in V8i I use this class in an Addin to Clip elements.
public class ClipService
{
[DllImport("ustation.dll", EntryPoint = "mdlClip_element", CallingConvention = CallingConvention.Cdecl)]
private static extern int mdlClip_element(ref int insideEdPP, ref int outsideEdPP, int inputEdP, int modelRef, int clipP, int view);
[DllImport("ustation.dll", EntryPoint = "mdlClip_getFence", CallingConvention = CallingConvention.Cdecl)]
private static extern int mdlClip_getFence(ref int clipPP);
[DllImport("ustation.dll", EntryPoint = "mdlClip_free", CallingConvention = CallingConvention.Cdecl)]
private static extern int mdlClip_free(ref int clipP);
[DllImport("ustation.dll", EntryPoint = "mdlClip_fromElement", CallingConvention = CallingConvention.Cdecl)]
private static extern int mdlClip_fromElement(ref int clipPP, int pElement, int outside, int pOutputTransform, int view);
private int clipPP;
private int modelRefP;
private int viewIndex;
/// <summary>
/// Konstruktor
/// </summary>
/// <param name="clip">Elememt an dem geschnitten werden soll</param>
/// <param name="modelRef">ModelReference in dem die Elemente liegen</param>
public ClipService(Element clip, ModelReference modelRef, View view)
{
var fence = Utilities.ComApp.ActiveDesignFile.Fence;
fence.DefineFromElement(view, clip);
viewIndex = view.Index - 1;
clipPP = 0;
modelRefP = modelRef.MdlModelRefP();
var ret = mdlClip_getFence(ref clipPP);
//var ret = mdlClip_fromElement(ref clipPP, clip.MdlElementDescrP(false), MSKonstanten.FALSE, 0, viewIndex);
}
/// <summary>
/// Destruktor (Speicher freigeben)
/// </summary>
~ClipService()
{
if (clipPP != 0)
{
mdlClip_free(ref clipPP);
}
}
/// <summary>
/// Element wird geclippt
/// </summary>
/// <param name="elementToClip">Element welches geclipped werden soll</param>
/// <returns>Clip Ergebnis oder null</returns>
public Element DoClip(Element elementToClip)
{
int insideEdP = 0;
int outsideEdP = 0;
var ret = mdlClip_element(ref insideEdP, ref outsideEdP, elementToClip.MdlElementDescrP(false), modelRefP, clipPP, viewIndex);
if (insideEdP != 0)
{
return Utilities.ComApp.MdlCreateElementFromElementDescrP(insideEdP);
}
return null;
}
}
Now I search for a clip function in Connect Update 6.
Can someone give me a hint? Is in the DgnPlatformNET Namespace any function to clip elements (line - line, line - shape)?
Thanks
Martin