PeterPan9720 Posted June 11, 2010 Share Posted June 11, 2010 Hi Guy thank you for the cooperation that you gave me until now, pls somebody know if it's possible to make a selection set of two different blocks in the drawing by VBA. I wrote this code, and of course it's working because I created 2 different selection set, but if I would like to have only one which select two different blocks ? is there a way ? GV(0) = "INSERT" '--------------------------------------------------- 'Revise the block name "tendnum1" for your application GV(1) = "X1-O-180" intCode(0) = 0 intCode(1) = 2 '--------------------------------------------------- ThisDrawing.SelectionSets.Add ("BOM") Set Ssnew = ThisDrawing.SelectionSets("BOM") Ssnew.Select acSelectionSetAll, , , intCode, GV GV(1) = "F44500-HD-D-48504Rev0a" ThisDrawing.SelectionSets.Add ("MySS") Set Ssnew1 = ThisDrawing.SelectionSets("MySS") Ssnew1.Select acSelectionSetAll, , , intCode, GV For Each Entity In Ssnew Array1 = Entity.GetAttributes Set BlocK = Entity X = BlocK.InsertionPoint(0) Y = BlocK.InsertionPoint(1) Z = BlocK.InsertionPoint(2) HAN = BlocK.Handle .... Next For Each Entity In Ssnew1 Array2 = Entity.GetAttributes Set BlocK = Entity X1 = BlocK.InsertionPoint(0) Y1 = BlocK.InsertionPoint(1) Z1 = BlocK.InsertionPoint(2) HAN1 = BlocK.Handle .... Next Thank you Quote Link to comment Share on other sites More sharing options...
fixo Posted June 11, 2010 Share Posted June 11, 2010 Hi Guy thank you for the cooperation that you gave me until now, pls somebody know if it's possible to make a selection set of two different blocks in the drawing by VBA.I wrote this code, and of course it's working because I created 2 different selection set, but if I would like to have only one which select two different blocks ? is there a way ? GV(0) = "INSERT" '--------------------------------------------------- 'Revise the block name "tendnum1" for your application GV(1) = "X1-O-180" intCode(0) = 0 intCode(1) = 2 '--------------------------------------------------- ThisDrawing.SelectionSets.Add ("BOM") Set Ssnew = ThisDrawing.SelectionSets("BOM") Ssnew.Select acSelectionSetAll, , , intCode, GV GV(1) = "F44500-HD-D-48504Rev0a" ThisDrawing.SelectionSets.Add ("MySS") Set Ssnew1 = ThisDrawing.SelectionSets("MySS") Ssnew1.Select acSelectionSetAll, , , intCode, GV For Each Entity In Ssnew Array1 = Entity.GetAttributes Set BlocK = Entity X = BlocK.InsertionPoint(0) Y = BlocK.InsertionPoint(1) Z = BlocK.InsertionPoint(2) HAN = BlocK.Handle .... Next For Each Entity In Ssnew1 Array2 = Entity.GetAttributes Set BlocK = Entity X1 = BlocK.InsertionPoint(0) Y1 = BlocK.InsertionPoint(1) Z1 = BlocK.InsertionPoint(2) HAN1 = BlocK.Handle .... Next Thank you Use a filter for block name as a string, separated by comma: GV(0) = "INSERT" GV(1) = "X1-O-180,F44500-HD-D-48504Rev0a" You can also add other block names as many as you need just separate by comma as well ~'J'~ Quote Link to comment Share on other sites More sharing options...
PeterPan9720 Posted June 11, 2010 Author Share Posted June 11, 2010 Use a filter for block name as a string, separated by comma: GV(0) = "INSERT" GV(1) = "X1-O-180,F44500-HD-D-48504Rev0a" You can also add other block names as many as you need just separate by comma as well ~'J'~ Thank you, it's working fine. Do you know the criteria of selection ? by X coordinate ? by Y ? or by insertion sequence ? because when the attributes data are extracted I find some of block 1 and some of block 2. Of course I'll manage later in the code but just to know the criteria. Quote Link to comment Share on other sites More sharing options...
PeterPan9720 Posted June 13, 2010 Author Share Posted June 13, 2010 Hi guys, Pls somebody could helps me in a little issue that I have ? If a make a selection of all blocks with filter option, eg "BLOCK1" and "BLOCK2" by selectionset function, I get an unique value for each block which is the HANDLE. With any drawing modification, if I make again the same selection set should I get the same Handle value ? it'correct ?. The main scope is to transfer some blocks attributes in a xls file, manipulate them, and store again in the same blocks. But seems doesn't work fine using the block handle option. I'ìll try to delete old blocks and insert the same with new attributes from excel. Somebody could suggest me the best way ? Thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.