Inventor Customization

Reply
Valued Contributor
Posts: 85
Registered: ‎11-09-2007
Message 1 of 5 (248 Views)

creat iassembly factory all member

248 Views, 4 Replies
02-21-2010 03:27 PM
hi

i want to creat iassembly member with macro

i write below code but give error "type mismatch"
how can i creat iassembly members with macro



Private Sub RegenerateExisting()

On Error Resume Next



' Open the factory document

Dim oFacDoc As AssemblyDocument

Set oFacDoc = oInventorApp.Documents.Open(sFacFullFileName)



Dim oCompDef As AssemblyComponentDefinition

Set oCompDef = oFacDoc.ComponentDefinition



Dim iNumRows As Integer

Dim oiPrtFac As iAssemblyFactory

Set oiPrtFac = oCompDef.iAssemblyFactory



iNumRows = oiPrtFac.TableRows.Count



Dim iRow As Integer

Dim oRow As iAssemblyTableRow

For iRow = 1 To iNumRows

' Need to retrieve the factory each time since the

' table objects are only valid for one transaction

Set oiPrtFac = oCompDef.iAssemblyFactory



Set oRow = oiPrtFac.TableRows(iRow)



' Get the filename for the row

Dim sMemFileName As String

sMemFileName = oRow.PartName



' Check if this file exists in the member file folder

If DoesFileExist(sMemFolderLoc + sMemFileName) = True Then

' Regenerate the member

Dim oMem As iAssemblyMember

Set oMem = oiPrtFac.CreateMember(iRow) {color:#ff0000}' This is row to give error{color}



Dim oMemDoc As Document

Set oMemDoc = oMem.Parent.Document



' Update the member

oMemDoc.Update

oMemDoc.Save

oMemDoc.Close

End If

Next



oFacDoc.Close



End Sub
Gökhan Kaya
Altar Teknoloji
App Engineer
*Sanjay Ramaswamy \(Autodesk\)
Message 2 of 5 (248 Views)

Re: creat iassembly factory all member

02-24-2010 04:03 PM in reply to: Altar_Kgokhan

The latest version of the
iAssemblyFactory.CreateMember does not return the member object. So change
this:

 

Set oMem = oiPrtFac.CreateMember(iRow)

 

to

 

Call oiPrtFac.CreateMember(iRow)

 

To get the member document, you'll need to store
the full file name and explicitly open that document using Documents.Open
method.

 

Sanjay-
Valued Contributor
Posts: 140
Registered: ‎11-16-2007
Message 3 of 5 (248 Views)

Re: creat iassembly factory all member

02-25-2010 08:41 AM in reply to: Altar_Kgokhan
> {quote:title=Guest wrote:}{quote}
>

>

>
 

>
To get the member document, you'll need to store
> the full file name and explicitly open that document using Documents.Open
> method.

>
 

>
Sanjay-

>

Struggling with the same thing at the moment, so the follow on equestion is as follows...

How do we get the full file name of the iAssembly member being generated from the current factory row?

Regards

MattH
*Sanjay Ramaswamy \(Autodesk\)
Message 4 of 5 (248 Views)

Re: creat iassembly factory all member

02-25-2010 03:15 PM in reply to: Altar_Kgokhan

The directory that the member will be located in is
returned by iAssemblyFactory.MemberCacheDir and the filename is returned by
iAssemblyTableRow.DocumentName.

 

Sanjay-
Contributor
maxstel
Posts: 21
Registered: ‎09-21-2011
Message 5 of 5 (122 Views)

Re: creat iassembly factory all member

02-19-2012 03:42 AM in reply to: *Sanjay Ramaswamy \(Autodesk\)

files not Regenerated if exists in subdir  any ideas?:smileysad:

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube