Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create smart point in UG Open API/C 1

Status
Not open for further replies.

gergs

Computer
Aug 20, 2004
94
0
0
US
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!
 
Replies continue below

Recommended for you

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.
 
Status
Not open for further replies.
Back
Top