turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Siemens PLM Community
- NX Customization and Programming
- NX Programming & Customization Forum
- How to auto divide the curve based on the position...

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-07-2017 12:41 PM - edited 06-07-2017 12:44 PM

Assume I have a red curve L and assume it is just a line to make it simple and an black object (which will be selected by user). The black object may or may not overlap the red line L. How could the red line L be devided into 2 segment L1 and L2 based on the position of the black object (the closest edege)? The cut point is not needed to be perfect as long as it is somewhere in the midle of the projected black object.

I guess just let the user selected the edge of the black object will be sufficident.

Solved! Go to Solution.

3 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-08-2017 12:43 AM - edited 06-08-2017 12:44 AM

Basically, you need to get a point P on the line L that is "near" the black object, B. Then you can use this point to divide the line. A few different ideas:

(1) Find the point P that is closest to B. Using SNAP, just call Snap.Compute.ClosestPoints.

(2) Find the centroid of B, and then project this onto the line L.

(3) Get the bounding box of B, find its center, and then project this center point onto the line L

(4) Find the extents of B in the direction of L, and use the mid-point of this extents interval

#3 would probably run the fastest.

None of these require the user to select an edge of B.

yamada

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-08-2017 06:41 AM

I will try #3, assuming that I already found the bounding box of B and its center, what function should I use to project this point to L?

Thanks for the help

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-08-2017 07:00 AM

Snap.Compute.ClosestPoints would probably be easiest.
**山田**

yamada

yamada

Follow Siemens PLM Software

© 2018 Siemens Product Lifecycle Management Software Inc