![]() |
【转帖】display the weight of a part in text bo
display the weight of a part in text box
hi i am trying to display the weight of a part in a text box of a form in my macro. can anybody help me? or just use the weight to multiply it by something. thanks in advance. solidworks 2006,2007,2008,2009 (office premium.) core 2 duo e6850 @ 3.00 mhz window xp pro sp3 32 bit ati firegl v7350 sub main() dim swapp as sldworks.sldworks dim part as sldworks.modeldoc2 dim mass as sldworks.massproperty set swapp = application.sldworks set part = swapp.activedoc set mass = part.extension.createmassproperty mass.usesystemunits = false debug.print mass.mass end sub instead of using debug.print, you can assign the value of mass.mass to your textbox. the format is up to you. when i ran this, the mass was being extracted as grams. you can then use mass.mass in a formula if you like. ex: yourtextboxnamehere.text = (mass.mass)/100 hope this helps. tony szuta cswa, cswp, cswp-smtl thanks alot i will try that solidworks 2006,2007,2008,2009 (office premium.) core 2 duo e6850 @ 3.00 mhz window xp pro sp3 32 bit ati firegl v7350 it does exactly what i want it to when i run it as a seperate macro but when i run it as a module inside of a different macro then it gives me a compile error. any ideas? solidworks 2006,2007,2008,2009 (office premium.) core 2 duo e6850 @ 3.00 mhz window xp pro sp3 32 bit ati firegl v7350 what error exactly do you get and also post the code problem was i did not have sw reference added in thanks luke! solidworks 2006,2007,2008,2009 (office premium.) core 2 duo e6850 @ 3.00 mhz window xp pro sp3 32 bit ati firegl v7350 quick |
所有的时间均为北京时间。 现在的时间是 08:24 AM. |