he_ll 发表于 2006-4-26 16:06:00

[求助] 修改CAD2006机械版部件数据

<INPUT class=btn style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体" onclick="text1.style.fontSize='12pt';" type=button value=12号字> <OPTION value="9pt">9pt</OPTION> <OPTION value="10pt" selected>10pt</OPTION> <OPTION value="11pt">11pt</OPTION> <OPTION value="12pt">12pt</OPTION> <OPTION value="13pt">13pt</OPTION> <OPTION value="15pt">15pt</OPTION>
<P><FONT id=text1 style="FONT-SIZE: 10pt" face="宋体,verdana, arial, helvetica"><BR>我使用autocad2006 type lib、autodesk mcadauto2.0 type lib 和 autodesk symbbauto2.0 type lib, 可以修改bom序号和数量,但是修改不了部件的数据,请高手介绍一种方法,用arx也行,拜谢!!!<BR><BR>vb修改程序如下:<BR>Dim acadApp As acadApplication<BR>Dim mcadApp As McadApplication<BR><BR>Dim idoc As IMcadDocument<BR>Dim ibom As IMcadBOMItem<BR><BR>Set acadApp = GetObject(, "AUTOCAD.Application.16")<BR>Set mcadApp = acadApp.GetInterfaceObject("Mcad.Application")<BR><BR>Set idoc = mcadApp.ActiveDocument<BR>Dim mpart As IMcadPartList<BR><BR>Set mpart = idoc.HostDocument.ModelSpace.Item(13) '此处取得IMcadPartList对象<BR><BR>'修改bom序号和数量<BR>mpart.ItemList(3).Quantity = 88<BR>mpart.ItemList(3).ItemNumber = "33"<BR>mpart.Update<BR><BR>'修改部件数据<BR>mpart.ItemList(3).Data(1, 1) = "dsfsf" '此处取一个部件属性进行修改,无效???<BR>mpart.Update</FONT> </P>
<P>还有如何获取mbomstandard对象, 有一个addcolum方法可能可以增加一个部件信息.</P>

ccaadd 发表于 2006-4-28 09:42:00

<P>哪位高手有修改标准件数据的方法吗?——求助</P>
<P>修改引用件程序如下,给各位也分享一下:</P>
<P>&nbsp;&nbsp;&nbsp; Dim acadapp As AcadApplication<BR>&nbsp;&nbsp;&nbsp; Dim mcadApp As McadApplication<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; Dim idoc As IAcadDocument<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; Set acadapp = GetObject(, "AUTOCAD.Application.16")<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; Set mcadApp = acadapp.GetInterfaceObject("Mcad.Application")<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; Set idoc = acadapp.ActiveDocument<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; Dim mpartref As McadPartReference<BR>&nbsp;&nbsp;&nbsp; Set mpartref = idoc.ModelSpace.Item(4)&nbsp; '此处取到一个引用件mcadpartref对象</P>
<P>&nbsp;&nbsp;&nbsp; Dim symbb As McadSymbolBBMgr<BR>&nbsp;&nbsp;&nbsp; Set symbb = acadapp.GetInterfaceObject("SymBBAuto.McadSymbolBBMgr")</P>
<P>&nbsp;&nbsp;&nbsp; Dim bommgr As McadBOMMgr<BR>&nbsp;&nbsp;&nbsp; Set bommgr = symbb.bommgr</P>
<P>&nbsp;&nbsp;&nbsp; Dim pdata() As String</P>
<P>&nbsp;&nbsp;&nbsp; pdata = mpartref .Data</P>
<P>&nbsp;&nbsp;&nbsp; pdata(0, 1) = "aaaa"<BR>&nbsp;&nbsp;&nbsp; pdata(1, 1) = "bbbbbb"</P>
<P>&nbsp;&nbsp;&nbsp; 。。。。</P>
<P>&nbsp;&nbsp;&nbsp; bommgr.SetPartData mbom, pdata<BR>&nbsp;&nbsp;&nbsp; acadapp.Update</P>
<P>联系MSN: <A href="mailto:hellilu@gmail.com" target="_blank" ><FONT color=#000000>hellilu@gmail.com</FONT></A>,,谢谢</P>
页: [1]
查看完整版本: [求助] 修改CAD2006机械版部件数据