This script will be slow if your drawing has thousands of objects. Also, it only duplicates the drawing object, not the data in the object's record. Enter the drawing name. Enter the number of duplications you want. 'vbscript Sub Main set comps = document.componentset dwgName = application.inputbox("Enter drawing name:","Drawing name") numDupes = application.inputbox("Enter number of times to duplicate:","Number") if dwgName = "" or numDupes = "" then application.messagebox "Must enter both parameters!", "Error" exit sub else dTest = False for each comp in comps if comp.Name = dwgName then dTest = True end if next if dTest <> True then application.messagebox "That component does not exist.","Error" exit sub else if isnumeric(numDupes) <> True then application.messagebox "Must enter numeric value!", "Error" exit sub else set d = comps(dwgName) set objs = d.ObjectSet test = False num = 0 for each obj in objs if obj.Selected = True then test = True num = num + 1 set theObj = obj.Geom end if next if test = False then application.messagebox "No object selected","Error" exit sub else if num > 1 then application.messagebox "Too many objects selected, only select 1","Error" exit sub else for i = 1 to cint(numDupes) objs.Add theObj next application.messagebox "Done! " & numDupes & " objects added.", "Status" end if end if end if end if end if End Sub
"The blessing in life is finding the torture you are comfortable with." - Jerry Seinfeld, 6/26/2013 |