QQ登录

只需一步,快速开始

快捷登录

登录 或者 注册 请先

UG爱好者

查看: 812|回复: 3

[求助] UG KF 二次开发 nx_askArcLength()函数报错

[复制链接]

上等兵

Rank: 1

1

主题

4

帖子

124

积分
发表于 2022-11-1 11:48:42 | 显示全部楼层 |阅读模式
目的 选择曲线 计算线长,nx_askArcLength()总是报错,帮看下代码 哪里错了!! 感谢!
(child) slect:
{
    Class, %ui_comp_group;
    title, "选择激光切割线测量线长";
    Members, {len:};
};

(Child) len:
{
  Class, %ui_comp_selection;
  many, true;
  SnapPointOverlay, false;
  SoUpdateOption, 3;
  Label, "选择曲线";
  Tooltip, "选择激光切割曲线";
  Scope, 1;
  FilterTriple, {{3,0,0},{5,0,0},{9,0,0}};
  SelectedObjects, {};
};

#计算曲线长度
#(Number) lenth1: ug_curve_askArcLength(any,len:);

(Number) lenth1: nx_askArcLength(len:SelectedObjects:);

有奖推广贴子: 

回复

使用道具 举报

上等兵

Rank: 1

1

主题

4

帖子

124

积分
 楼主| 发表于 2022-11-2 09:45:03 | 显示全部楼层
报错信息:
ug_curve_askarclength() failed : input is  neither an edge nor a curve
rule:
[rule in body of function--source not availbale yet]
回复 支持 反对

使用道具 举报

上等兵

Rank: 1

1

主题

4

帖子

124

积分
 楼主| 发表于 2022-11-2 09:46:12 | 显示全部楼层
函数:        nx_askArcLength
描述:        Returns the length of a given Curve/Edge
参数:        curve (Any) Specify a curve
返回:        (Number)- The length of a curve/edge
---
Returns the length of a given Curve/Edge
回复 支持 反对

使用道具 举报

上等兵

Rank: 1

1

主题

4

帖子

124

积分
 楼主| 发表于 2022-11-2 09:47:29 | 显示全部楼层
选择类:
DefClass: %ui_comp_selection (%ui_comp);

#+
    Single/Multiple selection control

    Single select   = False;
    Multiple select = True;
#-
(Canonical boolean Parameter Modifiable) Many: true;

#+
    SnapPointOverlay

    This attribute allows the addition of point creation to
    this selection component. If set to true, you have the option
    of either selecting an existing object and/or creating a new point.
    The point created will be added to the selectedObject list.

#-
(Canonical boolean Parameter Modifiable) SnapPointOverlay: false;

#+
   SoUpdateOption

   Smart Object Update Option

   This attribute controls the update behavior of a point created
   by using the SnapPointOverlay option.

   UF_SO_dont_update              = 0
   UF_SO_update_within_modeling   = 1
   UF_SO_update_after_modeling    = 2
   UF_SO_update_after_parent_body = 3
#-
(Canonical integer  Parameter Modifiable) SoUpdateOption: 3;

#+
    The text for label
#-
(Canonical string  Parameter Modifiable) Label: "Select Objects";

#+
    The text for tooltip
#-
(Canonical string  Parameter Modifiable) Tooltip: "Select Objects";

#+
  Scope

  Controls the selection scope for the object

  UF_UI_SEL_SCOPE_WORK_PART        1      Allows you to select only objects
                                          which belong to the work part.
                                          This includes immediate
                                          components of the work part. If
                                          you select an object occurrence,
                                          the prototype is returned.  

  UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY  3      Allows you to select any object
                                          or object occurrence in the
                                          assembly. No scope restrictions
                                          are applied.  

  UF_UI_SEL_SCOPE_WORK_PART_AND_OCC 4     Allows you to select objects
                                          which belong to the work part or
                                          its subassembly. If you select
                                          an object occurrence, the
                                          prototype is returned.  

  UF_UI_SEL_SCOPE_WORK_PART_AND_WP_OCC 5  Allows you to select objects
                                          which belong to the work part or
                                          its subassembly. If you select
                                          an object occurrence, the
                                          occurrence of the work part is returned.  
#-

(Canonical integer  Parameter Modifiable) Scope: 1;

#+
  The triple are a list of list in the format of {{type1, subtype1, feature_type1},
                                                  {type2, subtype2, feature_type2} ...}  

  type;         - This can be one of the object types that are listed in
                  uf_object_types.h

  subtype;      - This can either be UF_all_subtype, or a proper
                  subtype of the object type selected                                                  

  feature_type; - This is only meaningful when the object_type is
                  UF_solid_type.  In that case, this should be set to
                  one of the solid feature type constants in uf_ui_types.h:           

                  FEATURE_ANY_EDGE               1
                  FEATURE_LINEAR_EDGE            2
                  FEATURE_CIRCULAR_EDGE          3
                  FEATURE_ELLIPTICAL_EDGE        4
                  FEATURE_INTERSECTION_EDGE      5
                  FEATURE_BCURVE_EDGE            6
                  FEATURE_SPCURVE_EDGE           7
                  FEATURE_FOREIGN_EDGE           8
                  FEATURE_CNST_PARM_EDGE         9
                  FEATURE_ANY_WIRE_OR_EDGE      10
                  
                  FEATURE_ANY_FACE              20
                  FEATURE_PLANAR_FACE           21
                  FEATURE_CYLINDRICAL_FACE      22
                  FEATURE_CONICAL_FACE          23
                  FEATURE_SPHERICAL_FACE        24
                  FEATURE_TOROIDAL_FACE         25
                  FEATURE_PARAMETRIC_FACE       26
                  FEATURE_BLENDING_FACE         27
                  FEATURE_OFFSET_FACE           28
                  FEATURE_SWEPT_FACE            29
                  FEATURE_SWUNG_FACE            30
                  FEATURE_FOREIGN_FACE          31
                  
                  FEATURE_ANY_COMPOSITE_BODY    32
                  FEATURE_ANY_COMPOSITE_FACE    33
                  FEATURE_ANY_COMPOSITE_EDGE    34

                  FEATURE_SHEET_BODY            35
                  FEATURE_SOLID_BODY            36

   For example, to enable selection of only elliptical edges and spherical faces of solids,
   the list would be:

   {
     { 70, 2, 24 },    #Spherical faces
     { 70, 3,  4 }     #Elliptical edges
   }
#-

(Canonical list  Parameter Modifiable) FilterTriple: {};

#+
   The list of selected objects
#-

(Canonical List Parameter Modifiable) SelectedObjects: {};
#+ @deprecated SelectedObject
   please use SelectedObjects
#-
(Canonical List Parameter Modifiable) SelectedObject: SelectedObjects: ;

#+
   The coordinates of the last pick point
#-

(Point modifiable ) PickPoint: point(0,0,0);

#+
   The view of the last pick point
#-
(Any modifiable ) PickView: ;

(String) ClassName: "UGS::UI::Comp::KFselectObject";

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

 
 
QQ:1359218528
工作时间:
9:00-17:00
 
微信公众号
手机APP
机械社区
微信小程序

手机版|UG爱好者论坛 ( 京ICP备10217105号-2 )    论坛管理员QQ:1359218528

本站信息均由会员发表,不代表本网站立场,如侵犯了您的权利请联系管理员,邮箱:1359218528@qq.com  

Powered by UG爱好者 X3.2  © 2001-2014 Comsenz Inc. GMT+8, 2024-3-29 03:04

返回顶部