PeterPan9720 发表于 2022-7-6 22:14:07

是的,这是真的,每当程序找到块“标题块”时,您可以获得属性并根据上述AttributeList(0)进行修改。TextString=“EXCEL行或单元格值”,或AttributeList(1)所需的其他属性。Textsring=“EXCEL ROW COLUMN”等。
修改重复属性时,您可以根据需要在两个位置上通过上述步骤为图形编号(仅为重复属性之一)指定值,因为您将为两个不同的块属性AttributeList(XX)指定相同的excel行或列内容。Textsring=“图纸编号的EXCEL行列”,属性列表(YY)。Textsring=“图纸编号第二位置的EXCEL行列”,与“问题”属性相同。
相反,有一种方法可以使用选择集选择特定的块,但由于内部有大量的块

barakar42 发表于 2022-7-6 22:19:39

i'm trying to run the code and it comes up with the error:
         
        user defined type not defined on line "TypeOf oEnt Is AcadBlockReference"
         
         

PeterPan9720 发表于 2022-7-6 22:20:25

 
        First Question are you using Autocad or similar CAD ?
        and second issue please check the Option selected on Tools reference on Excel Development Area see picture
       

barakar42 发表于 2022-7-6 22:23:36

Where does the attribute list get saved so i can check which attributes i need to change?
         
        Also, is it possible to only change part of an attribute, e.g
         
        C####-E-000 to C1234-E-000

PeterPan9720 发表于 2022-7-6 22:26:26

All attributes are stored in AttributeList array, during routine debug you can check which is the attributes you need to change see picture above, check the properties AttributeList(XX).TAGSTRING for information on NAME of Attribute and AttributeList(XX).TEXSTRING for modification.
        For modification you can insert:
         
        If AttributeList(6).TEXTSTRING="C####-E-000" then ' DRAWINGNO SHALL BE at position 6 of AttributeList array check with debug.
            AttributeList(6).TEXTSTRING="C1234-E-000" 
        end if
       
        Of course Attribute value it's a string so you can manipulate as you need, it's could be from excel cell value, or LEFT("XXX", CharPos) or MID, or RIGHT.
         
        I hope above could solve your issue.
         

barakar42 发表于 2022-7-6 22:29:59

I understand that you have to run the program and "watch" the attributes to see the full list of them all, but when i try , it doesn't appear in a list like what you get. I'm probably doing something wrong, i've not got much experience with VBA yet

PeterPan9720 发表于 2022-7-6 22:35:20

Ok let explain goto into editing of code on row  
AttributeList = NewoblkRef.GetAttributes        and type function key F9 so you insert a break (you will see a red row) of procedure when it is running and will pass on that point of code. 
        Run the procedure and when break point will be reached click with right mouse button and select add watch option. 
        On VBA software you will have a debug windows where you can see the "watched" variable. Click on the + sign on visible variable on that window and you will have all properties of selected variable (see picture on previous post). 
        Search the attributes name in TAGSTRING property value, and then you can modify the TEXTSTRING property value for change it as I showed you before. 

barakar42 发表于 2022-7-6 22:36:22

I've followed those steps, but on the watch list, it says value is empty and there's no option for the plus icon 

PeterPan9720 发表于 2022-7-6 22:39:03

Let the procedure execute the code in row because when you break on a specific row this will be not executed. 
        Press F8 function key and watch again. And press F5 to run again until next breakpoint will be reached again. 
         

barakar42 发表于 2022-7-6 22:42:35

Thanks Peter, I can see that now. I'm going to try and edit the values now.
         
        Your help has been invaluable! 
页: 1 [2]
查看完整版本: VBA AutoCAD命令行变量