×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Create smart point in UG Open API/C

Create smart point in UG Open API/C

Create smart point in UG Open API/C

(OP)
Does anyone know whats up with the Create smart point in UG Open API/C? I get errors when I try and compile any code using this option. It seems there is no support in NX4.

Does anyone have a working code snippet of point routine that they could share if they have solved this?

What I am looking for is a point that will hold its position on a curve if it is resized. I can do a smart object point but not one that will stay in the middle if for example a 2 inch line becomes a 4 inch line.

Thanks all!

RE: Create smart point in UG Open API/C

Smart object has dynamic update fuctions,not a iolated object.

I create a point on a surface with following code.It will be updated when the face changed  .       

  Session theSession = Session.GetSession();

            try
            {
                Feature pnt = null;
                PointFeatureBuilder theBuilder = theSession.Parts.Work.BaseFeatures.CreatePointFeatureBuilder(null);

                NXObject sel;
                Point3d cursor;


                if (UI.GetUI().SelectionManager.SelectObject("", "",
                    Selection.SelectionScope.AnyInAssembly, true, new Selection.SelectionType[] { Selection.SelectionType.Faces },
                    out sel, out cursor)
                            == Selection.Response.ObjectSelected)
                {
                    Face theFace = sel as Face;
                    if (theFace != null)
                    {
                        //UI.GetUI().NXMessageBox.Show(null, NXMessageBox.DialogType.Information, theFace.ToString());

                        Scalar u = theSession.Parts.Work.Scalars.CreateScalar(0.5, Scalar.DimensionalityType.Length, SmartObject.UpdateOption.DontUpdate);
                        Scalar v = theSession.Parts.Work.Scalars.CreateScalar(0.5, Scalar.DimensionalityType.Length, SmartObject.UpdateOption.DontUpdate);

                        theBuilder.Point = theSession.Parts.Work.Points.CreatePoint(theFace, u, v, SmartObject.UpdateOption.AfterModeling);

                        theBuilder.Commit();
                    }
                }
            }

Nicholas (Kun Jiang)
PhD. Candidate,SJTU.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources