• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

rule to create excel sheet of an axieme

  • Thread starter Thread starter MB_MAN
  • Start date Start date

MB_MAN

Guest
Bye to all,

I am trying to create a rule that can allow me to export to an excel file a list of sub-assistances, parts, commercial parts, and bolts/vites etc.

for the moment I am arrangements using the "part list" command (use inventor in English because I work in uk) and then from them I have to make a lot of adjustments every time to have a satisfactory list to use.

I'll tell you what to do with this list.
in the company where I work besides releasing the drawings with the quantities required for each part I must create and release a "document" that shows which drawings have been printed and released in production. to do this job every time I have to retrace one by one all sub-assiemi and parts to see how many of these pieces were used in the main axieme in order to be able, physically scrute by hand on the design the quantity required and then screvere also on the "document" such information.
the "document" has specific columns with specific information, type,
  1. first column - file name
  2. second column - description
  3. third column - unitary quantity (to produce the main axieme)
  4. fourth colonnade - total quantity for commessa/job
to be able to overcome at least a part of this work (find and identify the quanita) I would like to have a rule that will expose me to a excel file, a list of the assemblies and parts used in the main axieme, and if there are two or more sub-assiemi or equal parts with the same file name but that are used in different sub-assiemi, I have to group in one righa only

example, a welded bracket composed of two parts; plate + tube. this welded bracket is used in an axieme "a" (assieme "a" and used only in the right part of the machine) and a "b" assembly (the latter is mounted only on the left), therefore the plate and the tube are in quanita 2 to be produced in total in order to create the main axieme. if then we have to produce 5 of these machines the plates and tubes become 10 each to produce.
 
questo esporta in excel, poi è da modificare in base alle tue esigenze

nome_file=thisdoc.filename(true) 'with extension (false) without extension
nome_file_no_est=thisdoc.filename(false) 'with extension (false) without extension
percorso=thisdoc.path
estensione = right (nome_file,3)

'{9c464203-9bae-11d3-8bad-0060b0ce6bb4} = lamiera
'{4d29b490-49b2-11d0-93c3-7e07060000000} = parte
'{bbf9fdf1-52cd-11d0-8c04-0800090be8ec} = tavola 2d
'{e60f81e1-49b3-11d0-93c3-7e0706000000} = assieme

tipo=iproperties.value("project", "document subtype")
if tipo <> "{e60f81e1-49b3-11d0-93c3-7e0706000000}" then
messagebox.show("eseguire il comando da un file di assieme (.iam).", "!!attenzione!!")
exit sub
else
end if

dim odoc as assemblydocument
oxls = "c:\__matteo__\___email___\bom-structuredalllevels.xls"
odoc = thisapplication.activedocument

'set a reference to the bom
dim obom as bom
obom = odoc.componentdefinition.bom

'set the structured view to 'all levels'
obom.structuredviewfirstlevelonly = false

' make sure that the structured view is enabled.
obom.structuredviewenabled = true

'set a reference to the "structured" bomview
dim ostructuredbomview as bomview
ostructuredbomview = obom.bomviews.item("strutturata") '("structured")

' export the bom view to an excel file
ostructuredbomview.export (oxls, kmicrosoftexcelformat)

'define excel application object
excelapp = createobject("excel.application")
'set excel to run visibly
'change to false if you want to run it invisibly
excelapp.visible = true

'open the workbook
wb = excelapp.workbooks.open(oxls)

'set all of the columns to autofit
excelapp.columns.autofit
'suppress prompts (such as the compatibility checker)
excelapp.displayalerts = false

''add a new sheet to the xls file
'excelapp.sheets.add.name = "sheet1"
''select the original exported sheet
'excelapp.sheets(2).select
''select range to copy
'excelapp.columns("g").copy
''select sheet to paste to
'excelapp.sheets("sheet1").select
''select range to paste to
'excelapp.columns("a").select
''paste the selection
'excelapp.activesheet.paste
''reset selected cell to a1
'excelapp.cells(1,1).select
''delete the original sheet
'excelapp.sheets(2).delete()

'save the workbook
wb.save
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top