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:
Checking and loading linetypes in .Net ObjectARX
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Checking and loading linetypes in .Net ObjectARX (Read 2215 times)
0 Members and 1 Guest are viewing this topic.
cannorth
Guest
Checking and loading linetypes in .Net ObjectARX
«
on:
November 30, 2011, 10:29:50 AM »
Hello,
I'd like to know how to write code that would check if a linetype exists and if it doesn't, then it will load the linetype from a .lin file.
Thanks,
cannorth
Logged
LE3
Guest
Re: Checking and loading linetypes in .Net ObjectARX
«
Reply #1 on:
November 30, 2011, 10:42:02 AM »
no sample i have available in .net but this is what i have used in arx - hth:
Code - C++:
[Select]
Acad
::
ErrorStatus
loadLinetype
(
const
ACHAR
*
entryName,
const
ACHAR
*
filename
=
_T
(
"acad.lin"
)
)
{
Acad
::
ErrorStatus
es
;
AcDbLinetypeTable
*
pTable
;
AcDbObjectId recordId
;
es
=
acdbCurDwg
(
)
-
>
getLinetypeTable
(
pTable, AcDb
::
kForRead
)
;
if
(
(
es
=
pTable
-
>
getAt
(
entryName, recordId
)
)
!
=
Acad
::
eOk
)
;
{
es
=
pTable
-
>
close
(
)
;
es
=
acdbCurDwg
(
)
-
>
loadLineTypeFile
(
entryName, filename
)
;
}
return
es
;
}
// and from your entry point... load your linetypes.
virtual
AcRx
::
AppRetCode
On_kLoadDwgMsg
(
void
*
pkt
)
{
AcRx
::
AppRetCode
retCode
=
AcRxArxApp
::
On_kLoadDwgMsg
(
pkt
)
;
AcApDocument
*
pDoc
;
pDoc
=
acDocManager
-
>
curDocument
(
)
;
pDoc
-
>
pushDbmod
(
)
;
const
ACHAR
*
items
[
]
=
{
_T
(
"BORDER"
)
, _T
(
"CENTER"
)
, _T
(
"DASHED"
)
, _T
(
"DASHDOT"
)
, _T
(
"HIDDEN"
)
, _T
(
"PHANTOM"
)
}
;
std
::
vector
<
const
ACHAR
*
, std
::
allocator
<
const
ACHAR
*
>>
v
(
items, items
+
sizeof
items
/
sizeof
*
items
)
;
for
(
int
i
=
0
;
i
<
v.
size
(
)
;
i
++
)
loadLinetype
(
v.
at
(
i
)
)
;
v.
clear
(
)
;
pDoc
-
>
popDbmod
(
)
;
return
(
retCode
)
;
}
«
Last Edit: December 04, 2011, 11:32:32 AM by le
»
Logged
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
.NET
»
Topic:
Checking and loading linetypes in .Net ObjectARX