Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

open model from excel speadsheet.

3 REPLIES 3
Reply
Message 1 of 4
warrentdo
352 Views, 3 Replies

open model from excel speadsheet.

warrentdo
Collaborator
Collaborator

Is it possiable to open a model from a list within excel?

 

My intension is to create a spread sheet that people can write to them create through i-logic rule that opens up each model, create a DWFX, then close the model and then open up the next model taken from the excel spread sheet and create the dwfx etc.

I have created one an rule that will create a dwfx from the open document. (oFileName = ThisDoc.FileName(False) 'without extension)

 

Thanks in advance.

 

Warren

 

'------start of iLogic-------

oPath = "X:\Projects\P15184\10 Drawings\Mechanical\Working\REVIEW\"

oFileName = ThisDoc.FileName(False) 'without extension

oRevNum = iProperties.Value("Project", "Revision Number")

oDWFAddIn = ThisApplication.ApplicationAddIns.ItemById _

("{0AC6FD95-2F4D-42CE-8BE0-8AEA580399E4}")

oDocument = ThisApplication.ActiveDocument

oContext = ThisApplication.TransientObjects.CreateTranslationContext

oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism

oOptions = ThisApplication.TransientObjects.CreateNameValueMap

oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

oFolder = "d:\warren\"

 

If oDWFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then

   oOptions.Value("Launch_Viewer") = launchviewer

   oOptions.Value("Publish_All_Component_Props") = 1

   oOptions.Value("Publish_All_Physical_Props") = 1

   oOptions.Value("Password") = 0

   oOptions.Value("Publish_3D_Models") = Publish_3D_Models

   If TypeOf oDocument Is DrawingDocument Then

       Dim oSheets As NameValueMap

       oSheets = ThisApplication.TransientObjects.CreateNameValueMap

       oOptions.Value("Publish_Mode") = DWFPublishModeEnum.kCustomDWFPublish

       oOptions.Value("Publish_All_Sheets") = 1

       ' Publish the first sheet AND its 3D model

       Dim oSheet1Options As NameValueMap

       oSheet1Options = ThisApplication.TransientObjects.CreateNameValueMap

       oSheet1Options.Add("Name", "Sheet:1")

       oSheet1Options.Add("3DModel", True)

       oSheets.Value("Sheet1") = oSheet1Options

   End If

End If

 

'get dwf target folder path

 

oFolder = Left(oPath, InStrRev(oPath, "\"))

 

'Set the DWF target file name

oDataMedium.FileName = oFolder & "\" & oFileName & " "& oRevNum & " Check Drawing" & ".dwf"

 

'Publish document

oDWFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)

i = MessageBox.Show("View the DWF file?", "Title",MessageBoxButtons.YesNo)

If i = vbYes Then : launchviewer = 1 : Else : launchviewer = 0 : End If

If launchviewer = 1 Then ThisDoc.Launch(oDataMedium.FileName)

'------------------- End Complex code added In To save all sheets --------------

0 Likes

open model from excel speadsheet.

Is it possiable to open a model from a list within excel?

 

My intension is to create a spread sheet that people can write to them create through i-logic rule that opens up each model, create a DWFX, then close the model and then open up the next model taken from the excel spread sheet and create the dwfx etc.

I have created one an rule that will create a dwfx from the open document. (oFileName = ThisDoc.FileName(False) 'without extension)

 

Thanks in advance.

 

Warren

 

'------start of iLogic-------

oPath = "X:\Projects\P15184\10 Drawings\Mechanical\Working\REVIEW\"

oFileName = ThisDoc.FileName(False) 'without extension

oRevNum = iProperties.Value("Project", "Revision Number")

oDWFAddIn = ThisApplication.ApplicationAddIns.ItemById _

("{0AC6FD95-2F4D-42CE-8BE0-8AEA580399E4}")

oDocument = ThisApplication.ActiveDocument

oContext = ThisApplication.TransientObjects.CreateTranslationContext

oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism

oOptions = ThisApplication.TransientObjects.CreateNameValueMap

oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

oFolder = "d:\warren\"

 

If oDWFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then

   oOptions.Value("Launch_Viewer") = launchviewer

   oOptions.Value("Publish_All_Component_Props") = 1

   oOptions.Value("Publish_All_Physical_Props") = 1

   oOptions.Value("Password") = 0

   oOptions.Value("Publish_3D_Models") = Publish_3D_Models

   If TypeOf oDocument Is DrawingDocument Then

       Dim oSheets As NameValueMap

       oSheets = ThisApplication.TransientObjects.CreateNameValueMap

       oOptions.Value("Publish_Mode") = DWFPublishModeEnum.kCustomDWFPublish

       oOptions.Value("Publish_All_Sheets") = 1

       ' Publish the first sheet AND its 3D model

       Dim oSheet1Options As NameValueMap

       oSheet1Options = ThisApplication.TransientObjects.CreateNameValueMap

       oSheet1Options.Add("Name", "Sheet:1")

       oSheet1Options.Add("3DModel", True)

       oSheets.Value("Sheet1") = oSheet1Options

   End If

End If

 

'get dwf target folder path

 

oFolder = Left(oPath, InStrRev(oPath, "\"))

 

'Set the DWF target file name

oDataMedium.FileName = oFolder & "\" & oFileName & " "& oRevNum & " Check Drawing" & ".dwf"

 

'Publish document

oDWFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)

i = MessageBox.Show("View the DWF file?", "Title",MessageBoxButtons.YesNo)

If i = vbYes Then : launchviewer = 1 : Else : launchviewer = 0 : End If

If launchviewer = 1 Then ThisDoc.Launch(oDataMedium.FileName)

'------------------- End Complex code added In To save all sheets --------------

3 REPLIES 3
Message 2 of 4
mcgyvr
in reply to: warrentdo

mcgyvr
Consultant
Consultant

You can just create a hyperlink in Excel to open any files.. inventor files included..

 

However...any reason you don't just use task scheduler to batch publish dwf files?

Or just setup auto dwf publishing on save trigger via ilogic?

Or if you use vault I thought it would automatically create dwf files..



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes

You can just create a hyperlink in Excel to open any files.. inventor files included..

 

However...any reason you don't just use task scheduler to batch publish dwf files?

Or just setup auto dwf publishing on save trigger via ilogic?

Or if you use vault I thought it would automatically create dwf files..



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 3 of 4
warrentdo
in reply to: mcgyvr

warrentdo
Collaborator
Collaborator

Hello Mcgyvr,

 

We are only doing a sellection of the files (5%) and not all.

Task scheduler means that you have to add the file to the task and we would have 3 different users at three different sites adding files.

It would be easier if they all have access to spread sheet that they could add the files to then run the logic from the spreadsheet?

 

Save on trigger is slowing down the model 'save' as the files may be saved a few times a day and they are quite large files. Also this would catch all files and not the 5%.

 

Vault DWF create leads to problems with the file name .iam.dwf and also vault doesnt create the dwfx with custom iprops (but I may be wrong)

it is disabled due to dwfx overhead.

 

I just thought that each user filling new files into a speadsheet then run the i-logic at the end of the week would work the best?

 

 

Cheers,

 

Warren.

0 Likes

Hello Mcgyvr,

 

We are only doing a sellection of the files (5%) and not all.

Task scheduler means that you have to add the file to the task and we would have 3 different users at three different sites adding files.

It would be easier if they all have access to spread sheet that they could add the files to then run the logic from the spreadsheet?

 

Save on trigger is slowing down the model 'save' as the files may be saved a few times a day and they are quite large files. Also this would catch all files and not the 5%.

 

Vault DWF create leads to problems with the file name .iam.dwf and also vault doesnt create the dwfx with custom iprops (but I may be wrong)

it is disabled due to dwfx overhead.

 

I just thought that each user filling new files into a speadsheet then run the i-logic at the end of the week would work the best?

 

 

Cheers,

 

Warren.

Message 4 of 4
warrentdo
in reply to: warrentdo

warrentdo
Collaborator
Collaborator

Hello all, any more for opening a set of Models from a speadsheet to then create dwfx from them?

Regards,

Warren. 

0 Likes

Hello all, any more for opening a set of Models from a speadsheet to then create dwfx from them?

Regards,

Warren. 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report