乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 77|回复: 3

SplitCurves In Order

[复制链接]

129

主题

422

帖子

5

银币

中流砥柱

Rank: 25

铜币
936
发表于 2016-11-5 16:06:58 | 显示全部楼层 |阅读模式
Need a little help.  I need to use splitcurves to break lines, polylines, and arcs but I need the breaks to occur in order from start of line to end of line. The routine I have now randomly breaks them creating segments longer than they should be.  It's hard for me to explain but hopefully the attached picture will help.
Any idea how I can break my polyline segments in order from start to end at my point locations?
[ol]    Entity myent = (Entity)myid.GetObject(OpenMode.ForWrite);

                            Curve curve = myent as Curve;

                            Point3dCollection newpointcoll = new Point3dCollection();
                            foreach (Point3d mypnt in breakpoints)
                            {
                                Point3d nearpoint = curve.GetClosestPointTo(mypnt, false);
                                if (nearpoint.DistanceTo(mypnt)
                                {
                                    newpointcoll.Add(nearpoint);
                                }
                            }
                            newCurves = curve.GetSplitCurves(newpointcoll);[/ol]
回复

使用道具 举报

129

主题

422

帖子

5

银币

中流砥柱

Rank: 25

铜币
936
发表于 2016-11-5 22:41:23 | 显示全部楼层
Nevermind. I think I have my head wrapped around it now.  Nothing like a good vr break.  I should be able to get the parameters of the points, sort then in order, then get the point locations again based on those parameters.  Wish me luck
回复

使用道具 举报

129

主题

422

帖子

5

银币

中流砥柱

Rank: 25

铜币
936
发表于 2016-11-5 22:45:14 | 显示全部楼层
That did the trick
[ol]                     List lst = new List();
                            DoubleCollection paramcollection = new DoubleCollection();
                            foreach (Point3d pnt in newpointcoll)
                                lst.Add(curve.GetParameterAtPoint(pnt));
                            lst.Sort();
                            foreach (double param in lst)
                                paramcollection.Add(param);
                            newCurves = curve.GetSplitCurves(paramcollection);[/ol]
回复

使用道具 举报

57

主题

559

帖子

13

银币

中流砥柱

Rank: 25

铜币
786
发表于 2016-11-6 01:10:03 | 显示全部楼层
good to see the thought process and the resulting code !
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-2-4 16:02 , Processed in 0.155187 second(s), 60 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表