找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 614|回复: 1

[ARX程序]:请教,如何求两条pline的交点?

[复制链接]
发表于 2007-5-18 14:57:06 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
如何求两条pline的交点?
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2007-5-25 08:51:31 | 显示全部楼层
Up a level to AcDbEntity         
AcDbEntity::intersectWith Function virtual Acad::ErrorStatus

intersectWith(

const AcDbEntity* pEnt,

AcDb::Intersect intType,

AcGePoint3dArray& points,

int thisGsMarker = 0,

int otherGsMarker = 0) const;

pEnt Input entity with which "this" entity is to intersect
intType Input type of intersection requested
points Output with the points of intersection appended
thisGsMarker Input GS marker of subentity of "this" entity that's involved in the intersection operation. Use the 0 default if not applicable.
otherGsMarker Input GS marker of subentity of the entity pointed to by pEnt that's involved in the intersection operation. Use the 0 default if not applicable.

Function usage

It finds the intersections of the entity pointed to by pEnt and all the edges of the bounding box of this entity.

The intType is used to determine how to deal with extending the two entities in order to calculate intersections. The possible AcDb::Intersect values are:

Value Meaning
AcDb::kOnBothOperands Do not extend either entity. This results in only calculating intersections where the two entitys' geometry actually intersect
AcDb::kExtendThis Extend this entity (if necessary) when calculating intersections, but do not extend the pEnt entity.
AcDb::kExtendArg Extend the pEnt entity (if necessary) when calculating intersections, but do not extend this entity.
AcDb::kExtendBoth Extend both the pEnt entity and this entity (if necessary) when calculating intersections

Any intersection points found are appended to the points array. All points are in WCS coordinates.

The thisGsMarker and otherGsMarker arguments are intended to provide this function with information to allow it to localize the search for intersections to be between specific subentities. However, this function is not required to make use of either of these arguments (most, if not all, of the AutoCAD built-in entity classes do not). When calling this function, either or both of these arguments may be 0 in order to indicate that they should be ignored.

If this function is successful it returns Acad::eOk. Return values for error conditions are dependent on the implementation of this function in the classes involved.

Function implementation in derived classes

This function should do all it can to find all intersection points between the entity it's being called on and the entity pointed to by pEnt. All intersection points found should be appended to the points array. All such points must be in WCS coordinates.

When implementing the intersection calculation portion of this function you should take a good look at the AcGe classes to see if they can provide any useful functionality to help in finding intersections with the geometric primitives that make up the entity this function is being called on and the pEnt entity. For example, the AcGeCurve3d class has an isOn() method that will indicate if a supplied point is on the curve and the AcGeArc3d class has several intersectWith() methods to find intersections with other AcGe types.

If the pEnt entity is a type not recognized by this function, it is quite reasonable to call the pEnt entity's intersectWith() method passing in a pointer to this entity as the "pEnt", and all the other arguments passed into this function (remembering to convert the intType argument If necessary) to see if that entity can determine any intersection points. This is what the AutoCAD built-in classes do.

Also, don't forget to take into account the intType value. The intType tells you which, if any, of the two entities should be extended to find "apparent" intersections. It is not required that apparent intersection be supported, but if it is not, then an appropriate ErrorStatus value should be returned to indicate that the call failed.

The thisGsMarker and otherGsMarker arguments are provided to allow this function to determine exactly which subentities are involved in the intersection operation (for example, if this function is being called by AutoCAD as part of an intersection Osnap operation these arguments would indicate which subentities are within the osnap pickbox). For these arguments, a value less than or equal to zero indicates that that argument should not be used.

If this function completes successfully (even if no intersection points are found), it should return Acad::eOk. Determining what is considered an error and what ErrorStatus return code to use for any such errors are up to the implementor -- there are no conventions in this regard.

Default implementation: Immediately returns Acad::eNotImplemented.


--------------------------------------------------------------------------------

virtual Acad::ErrorStatus

intersectWith(

const AcDbEntity* pEnt,

AcDb::Intersect intType,

const AcGePlane& projPlane,

AcGePoint3dArray& points,

int thisGsMarker = 0,

int otherGsMarker = 0) const;

pEnt Input entity with which "this" entity is to intersect
intType Input type of intersection requested. The possible AcDb::Intersect values are:
Value Meaning
AcDb::kOnBothOperands Do not extend either entity. This results in only calculating intersections where the two entitys' geometry actually intersect
AcDb::kExtendThis Extend this entity (if necessary) when calculating intersections, but do not extend the pEnt entity.
AcDb::kExtendArg Extend the pEnt entity (if necessary) when calculating intersections, but do not extend this entity.
AcDb::kExtendBoth Extend both the pEnt entity and this entity (if necessary) when calculating intersections

projPlane Input a projection plane for the apparent intersection of the two entities
points Output with the points of intersection appended
thisGsMarker Input GS marker of subentity of "this" entity that's involved in the intersection operation. Use the 0 default if not applicable.
otherGsMarker Input GS marker of subentity of the entity pointed to by pEnt that's involved in the intersection operation. Use the 0 default if not applicable.

Same as the other version of this function except that it projects this entity and the pEnt entity onto the projPlane, finds the intersection points, and then projects the intersection points back onto this entity. So, all points appended to the points array will be on this entity. The projections are done parallel to the projPlane's normal vector.

When implementing the intersection calculation portion of this function, in addition to the intersection functionality mentioned in the documentation on the other version of this function, the AcGe classes have functionality available to aid in the projection onto a plane and the projection of points onto AcGe objects.
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2025-9-11 05:57 , Processed in 0.374433 second(s), 32 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表