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:
Edit attributes on closed drawing
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Edit attributes on closed drawing (Read 2184 times)
0 Members and 1 Guest are viewing this topic.
latour_g
Newt
Posts: 184
Edit attributes on closed drawing
«
on:
October 03, 2019, 09:37:27 AM »
This might be a little tricky .. or not but I can't figure out the solution
I have a command that edit attributes on closed drawing. It only change the content. It works fine for changing the content but it does not adjust at the right justification. It keep the actual insertion point so it is offset.
Any idea ?
Thank you !
Code - C++:
[Select]
BlockTableRecord bDef
=
(
BlockTableRecord
)
tr.
GetObject
(
blkTable
[
cNomBlk
]
, OpenMode.
ForWrite
,
false
)
;
ObjectIdCollection objColl
=
bDef.
GetBlockReferenceIds
(
false
,
true
)
;
foreach
(
ObjectId objId in objColl
)
{
BlockReference br
=
(
BlockReference
)
tr.
GetObject
(
objId, OpenMode.
ForWrite
,
true
)
;
if
(
br.
AttributeCollection
.
Count
>
0
)
{
foreach
(
ObjectId id in br.
AttributeCollection
)
{
AttributeReference att
=
(
AttributeReference
)
tr.
GetObject
(
id, OpenMode.
ForWrite
)
;
if
(
attValLst.
Contains
(
att.
Tag
.
ToUpper
(
)
)
)
{
att.
TextString
=
attValueLst
[
att.
Tag
.
ToUpper
(
)
]
.
ToString
(
)
;
}
}
br.
RecordGraphicsModified
(
true
)
;
}
}
«
Last Edit: October 03, 2019, 11:19:02 AM by latour_g
»
Logged
n.yuan
Bull Frog
Posts: 348
Re: Edit attrbiutes on closed drawing
«
Reply #1 on:
October 03, 2019, 09:57:38 AM »
I assume "closed drawing" means opened side database, in which you update attributes of certain blockreferences.
This is a know issue and have been discussed in AutoCAD discussion forum, and maybe also in this forum, a few times; such as this:
https://forums.autodesk.com/t5/net/changed-attribute-text-in-sidedb-does-not-re-align-when/m-p/8665044
HTH
Logged
latour_g
Newt
Posts: 184
Re: Edit attributes on closed drawing
«
Reply #2 on:
October 03, 2019, 11:21:03 AM »
You are absolutely right, I needed to use HostApplicationServices.WorkingDatabase
Thank you so much !
Logged
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
.NET
»
Topic:
Edit attributes on closed drawing