get current material of a part

get current material of a part

Anonymous
Not applicable
269 Views
3 Replies
Message 1 of 4

get current material of a part

Anonymous
Not applicable
I am able to extract a list of all possible materials in a part with VBA,
but cannot seem to find a way to get the current.

I'd like to assign the name of the current material to a string variable.
Anybody know how to do this?


--
Jorgen Bjornes
----------------------------------------------
Are you located in the Oslo-area, and need a Mechanical Engineer who really
knows Inventor?
I'm currently available for short-term, long-term or permanent jobs.
See www.bjornes.org for more info and resume (in Norwegian).
----------------------------------------------
0 Likes
270 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Material =
oPropsets.Item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}").ItemByPropId(kMater
ialDesignTrackingProperties).Value

It's in the initalize part of the code I sent you...

--
Sean Dotson, PE
http://www.sdotson.com
Check the Inventor FAQ for most common questions
www.sdotson.com/faq.html
"...and quit driving 50MPH in the left lane!!!"
-----------------------------------------------------------------------
"Jorgen Bjornes" wrote in message
news:oprq067rlympwhjz@localhost...
> I am able to extract a list of all possible materials in a part with VBA,
> but cannot seem to find a way to get the current.
>
> I'd like to assign the name of the current material to a string variable.
> Anybody know how to do this?
>
>
> --
> Jorgen Bjornes
> ----------------------------------------------
> Are you located in the Oslo-area, and need a Mechanical Engineer who
really
> knows Inventor?
> I'm currently available for short-term, long-term or permanent jobs.
> See www.bjornes.org for more info and resume (in Norwegian).
> ----------------------------------------------
0 Likes
Message 3 of 4

Anonymous
Not applicable
Does this do what you need

Option Explicit

Public Sub getmat()
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oComp As ComponentDefinition
Set oComp = oDoc.ComponentDefinition

MsgBox oComp.Material.Name



End Sub


--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"Jorgen Bjornes" wrote in message news:oprq067rlympwhjz@localhost...
> I am able to extract a list of all possible materials in a part with VBA,
> but cannot seem to find a way to get the current.
0 Likes
Message 4 of 4

Anonymous
Not applicable
On Thu, 19 Jun 2003 14:18:08 -0700, Sean Dotson" at sdotson dot com
wrote:
> It's in the initalize part of the code I sent you...


I could not find this small detail. Seemed like you had made some funny
workaround.
But it got late yesterday, so I probably mixed things up.

I'll try again tomight

Thanks, both Kent and Sean.
I'll look into both suggestion, and pick the one I like best 😉


--

Jorgen Bjornes
----------------------------------------------
www.bjornes.org
----------------------------------------------
0 Likes