Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
.NET
»
Topic:
how to find itersection points
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: how to find itersection points (Read 1562 times)
0 Members and 1 Guest are viewing this topic.
xsakabsx
Guest
how to find itersection points
«
on:
October 04, 2012, 06:21:54 AM »
how to find intersection point of polyline and cirle ?
Sorry for bad ENG (rus to eng)
Logged
gile
Gator
Posts: 2507
Marseille, France
WWW
Re: how to find itersection points
«
Reply #1 on:
October 04, 2012, 06:47:48 AM »
Hi,
Look at the Entity.Intersectwith() method.
Here's a little C# sample:
Code - C#:
[Select]
[
CommandMethod
(
"Test"
)
]
public
void
Test
(
)
{
Document doc
=
AcAp
.
DocumentManager
.
MdiActiveDocument
;
Database db
=
doc
.
Database
;
Editor ed
=
doc
.
Editor
;
PromptEntityOptions peo
=
new
PromptEntityOptions
(
"
\n
Select the first curve: "
)
;
peo
.
SetRejectMessage
(
"Only a curve !"
)
;
peo
.
AddAllowedClass
(
typeof
(
Curve
)
,
false
)
;
PromptEntityResult per
=
ed
.
GetEntity
(
peo
)
;
if
(
per
.
Status
!=
PromptStatus
.
OK
)
return
;
ObjectId id1
=
per
.
ObjectId
;
peo
.
Message
=
"
\n
Select the second curve: "
;
per
=
ed
.
GetEntity
(
peo
)
;
if
(
per
.
Status
!=
PromptStatus
.
OK
)
return
;
ObjectId id2
=
per
.
ObjectId
;
using
(
Transaction tr
=
db
.
TransactionManager
.
StartTransaction
(
)
)
{
Curve curve1
=
(
Curve
)
tr
.
GetObject
(
id1, OpenMode
.
ForRead
)
;
Curve curve2
=
(
Curve
)
tr
.
GetObject
(
id2, OpenMode
.
ForRead
)
;
Point3dCollection pts
=
new
Point3dCollection
(
)
;
curve1
.
IntersectWith
(
curve2, Intersect
.
OnBothOperands
, pts,
0
,
0
)
;
BlockTableRecord ms
=
(
BlockTableRecord
)
tr
.
GetObject
(
db
.
CurrentSpaceId
, OpenMode
.
ForWrite
)
;
foreach
(
Point3d pt
in
pts
)
{
ed
.
WriteMessage
(
"
\n
"
+
pt
.
ToString
(
)
)
;
Circle c
=
new
Circle
(
pt, Vector3d
.
ZAxis
,
10.0
)
;
ms
.
AppendEntity
(
c
)
;
tr
.
AddNewlyCreatedDBObject
(
c,
true
)
;
}
tr
.
Commit
(
)
;
}
}
Logged
Speaking English as a French Frog
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
.NET
»
Topic:
how to find itersection points