几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   SolidWorks二次开发 (http://www.dimcax.com/hust/forumdisplay.php?f=111)
-   -   【转帖】modify block attribute value with dwgeditor vb api (http://www.dimcax.com/hust/showthread.php?t=5539)

yang686526 2009-04-13 12:53 PM

【转帖】modify block attribute value with dwgeditor vb api
 
modify block attribute value with dwgeditor vb api
hallo,
i'm trying as follow to modify block attribute property using the visual basic api.
dim m_blk as dwgeditor.block
dim i as integer
for each m_blk in activedocument.blocks
if "block_name" = m_blk.name then
for i = 1 to m_blk.count
dim m_obj as object
set m_obj = m_blk.item(i)
if m_blk.item(i).entitytype = vicattributedef then
if m_blk.item(i).tagstring = "tomatchtag" then
m_obj.textstring = "edited text string"
m_obj.update
m_blk.reload
end if
end if
set m_obj = nothing
next
end if
next
activedocument.save
i can successfully run the code. but doing so does not change the attribute.
what am i missing?
thx a lot for helping
i didn't even know dwgeditor had an api, i cannot seem to find the api help for it nor have i looked for the files to reference to in order to use it. do you have a link to the api so i can take a look?
luke,
for the api help look in the dwgeditor help file. it has a section called developer reference explaining the four available languages. what about testing your autocad lisp skills... ;-)
jorn bjarning
cswp
cad & plm consultant
sw2008 sp5 / sw2009 sp2
have you checked your code debugging and stepping though each line to see if you actually get into the following if statement:
if m_blk.item(i).tagstring = "tomatchtag" then
...


所有的时间均为北京时间。 现在的时间是 07:00 AM.