1 [DllImport("libufun.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, EntryPoint = "UF_MODL_create_proj_curves")] 2 internal static extern int _CreateProjCurves(System.IntPtr curveRefs, System.IntPtr faceRefs, int alongFaceNormal, double[] projVector, out NXOpen.Tag projCurveFeature); 3 4 [DllImport("libufun.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, EntryPoint = "UF_MODL_create_list")] 5 internal static extern int CreateList(out System.IntPtr list); 6 [DllImport("libufun.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, EntryPoint = "UF_MODL_put_list_item")] 7 internal static extern int PutListItem(System.IntPtr list, NXOpen.Tag objId); 8 9 internal static System.IntPtr ListFromArray(NXOpen.Tag[] array) 10 { 11 System.IntPtr intPtr; 12 CreateList(out intPtr); 13 for (int i = 0; i < array.Length; i++) 14 { 15 PutListItem(intPtr, array[i]); 16 } 17 return intPtr; 18 } 19 20 /// <summary> 21 /// 创建投影特征 22 /// </summary> 23 /// <param name="curveRefs">需要投影的曲线</param> 24 /// <param name="faceRefs">投影面</param> 25 /// <param name="alongFaceNormal">是否使用面的法向</param> 26 /// <param name="projVector">指定矢量</param> 27 /// <param name="projCurveFeature">投影的特征</param> 28 public void CreateProjCurves(NXOpen.Tag[] curveRefs, NXOpen.Tag[] faceRefs, int alongFaceNormal, double[] projVector, out NXOpen.Tag projCurveFeature) 29 { 30 System.IntPtr curveRefs2 = ListFromArray(curveRefs); 31 System.IntPtr faceRefs2 = ListFromArray(faceRefs); 32 NXOpen.Utilities.JAM.StartUFCall(); 33 int error = _CreateProjCurves(curveRefs2, faceRefs2, alongFaceNormal, projVector, out projCurveFeature); 34 NXOpen.Utilities.JAM.EndUFCall(); 35 if (error != 0) 36 { 37 throw NXOpen.NXException.Create(error); 38 } 39 }