Getting a Parameter value from file as string

Getting a Parameter value from file as string

machiel.veldkamp
Collaborator Collaborator
517 Views
3 Replies
Message 1 of 4

Getting a Parameter value from file as string

machiel.veldkamp
Collaborator
Collaborator

Hi!

 

I have this:

 

	Dim oModel As PartDocument
	FilePath = "C:\Relco\Vault\Designs\USERS EU\MACHIEL VELDKAMP\BulkDrawingToolParam.ipt"
	oModel = ThisApplication.Documents.Open(FilePath, False)
	auto = iLogicVb.Automation
	
	
	auto.RunRule(oModel, "Show Form") 'in the model there is a rule called "Show Form" that changes some parameters
	
	ILOGIC_PRINT = Parameter(<What should I put here?>, "ILOGIC_PRINT")
	

I want the ILOGIC_PRINT to contain the value that is currently in the model. 

 

Now. I thought this would be easy but I can't figure it out. 

If I put FilePath or oModel in the Parameter field It returns an error saying that that it's not an object. 

 

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes
Accepted solutions (1)
518 Views
3 Replies
Replies (3)
Message 2 of 4

machiel.veldkamp
Collaborator
Collaborator
	Dim oModel As PartDocument
	FilePath = "C:\Relco\Vault\Designs\USERS EU\MACHIEL VELDKAMP\BulkDrawingToolParam.ipt"
	oModel = ThisApplication.Documents.Open(FilePath, TRUE)
	auto = iLogicVb.Automation
	
	
	auto.RunRule(oModel, "Show Form")
	Test = oModel.FullDocumentName
	Dim ILOGIC_PRINT As String
	
	ILOGIC_PRINT = Parameter(Test, "ILOGIC_PRINT")
	MessageBox.Show(ILOGIC_PRINT, "Title")

This returns:

 

Parameter: The document named "C:\Relco\Vault\Designs\USERS EU\MACHIEL VELDKAMP\BulkDrawingToolParam.ipt" was not found.

 

That is so strange because 2ms before I open that document. 

What is happening?

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes
Message 3 of 4

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

Hi, try with this rule.
Keep in mind to close the document at the end of your rule, because you have opened the document in hidden mode first.

 

	Dim oModel As PartDocument
	FilePath = "C:\Relco\Vault\Designs\USERS EU\MACHIEL VELDKAMP\BulkDrawingToolParam.ipt"
	oModel = ThisApplication.Documents.Open(FilePath, False)
	auto = iLogicVb.Automation
	
	
	auto.RunRule(oModel, "Show Form") 'in the model there is a rule called "Show Form" that changes some parameters
	
	IlogicPrint = oModel.ComponentDefinition.Parameters("ILOGIC_PRINT").Value
	
	'oModel.Close

 I hope the rule works for you. Grettings


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 4 of 4

machiel.veldkamp
Collaborator
Collaborator

Ah brilliant. 

 

Thanks a lot!

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes