Inventor General Discussion

Inventor General Discussion

Reply
Employee
MjDeck
Posts: 959
Registered: ‎02-24-2009
Message 11 of 20 (1,147 Views)

Re: iLogic to set iProperty date

05-11-2011 08:15 AM in reply to: stephengibson76

Did you write the rule, or is it from somebody else?

You only posted a small sample of the rule, right?  Can you post the complete rule, maybe as a text file?

If you click Control-A in the rule editor, it will select all text.  Then you can cut and paste it to Notepad, save it, and attach the file here.

 But the rule probably depends on something in the drawing.  So the best thing would be to attach the drawing file (Inventor 2011 version) and any linked assembly and part files (maybe using Pack and Go).

 



Mike Deck
Software Developer
DLS - Mechanical Design
Autodesk, Inc.

Valued Mentor
stephengibson76
Posts: 1,112
Registered: ‎08-01-2006
Message 12 of 20 (1,144 Views)

Re: iLogic to set iProperty date

05-11-2011 08:21 AM in reply to: MjDeck

sorry, i thought I attached it last time

Stephen Gibson



View stephen gibson's profile on LinkedIn


Employee
MjDeck
Posts: 959
Registered: ‎02-24-2009
Message 13 of 20 (1,136 Views)

Re: iLogic to set iProperty date

05-11-2011 12:24 PM in reply to: stephengibson76

It will work in Inventor 2012 if you add the line:

ActiveSheet.Sheet.Update

to the end of your Zones rule (after the End If).

 



Mike Deck
Software Developer
DLS - Mechanical Design
Autodesk, Inc.

Valued Mentor
stephengibson76
Posts: 1,112
Registered: ‎08-01-2006
Message 14 of 20 (1,121 Views)

Re: iLogic to set iProperty date

05-12-2011 01:42 AM in reply to: MjDeck

thanks but I am still getting the same error

Stephen Gibson



View stephen gibson's profile on LinkedIn


Employee
MjDeck
Posts: 959
Registered: ‎02-24-2009
Message 15 of 20 (1,114 Views)

Re: iLogic to set iProperty date

05-12-2011 06:40 AM in reply to: stephengibson76

What is the error you're getting?  If there is a message, can you post it here?

On my system, it wasn't updating the text on the sheet border.  But adding the Update line fixed it.



Mike Deck
Software Developer
DLS - Mechanical Design
Autodesk, Inc.

Valued Mentor
stephengibson76
Posts: 1,112
Registered: ‎08-01-2006
Message 16 of 20 (1,112 Views)

Re: iLogic to set iProperty date

05-12-2011 06:46 AM in reply to: MjDeck

error message

 

 

Error in rule: Zones, in document: GM Drawing.idw
Conversion from string "-" to type 'Double' is not valid.

 

Error in rule: Zones, in document: GM Drawing.idw
Conversion from string "-" to type 'Double' is not valid.

 

more info

 

 

System.InvalidCastException: Conversion from string "-" to type 'Double' is not valid. ---> System.FormatException: Input string was not in a correct format.

   at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat)

   at Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble(String Value, NumberFormatInfo NumberFormat)

   --- End of inner exception stack trace ---

   at Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble(String Value, NumberFormatInfo NumberFormat)

   at Microsoft.VisualBasic.CompilerServices.Operators.CompareObject2(Object Left, Object Right, Boolean TextCompare)

   at Microsoft.VisualBasic.CompilerServices.Operators.CompareObjectEqual(Object Left, Object Right, Boolean TextCompare)

   at LmiRuleScript.Main()

   at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)

   at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

Stephen Gibson



View stephen gibson's profile on LinkedIn


Employee
MjDeck
Posts: 959
Registered: ‎02-24-2009
Message 17 of 20 (1,108 Views)

Re: iLogic to set iProperty date

05-12-2011 07:24 AM in reply to: stephengibson76

It looks like your SheetNo property is set to  -  (dash)

Your rule can only handle SheetNo as a number.  What do you want to set the zone numbers to if SheetNo is a dash?  To leave the zone numbers unchanged, add this line to the top of your rule:

If iProperties.Value("Custom", "SheetNo") = "-"  Then Return

 

If this doesn't work, please send me the latest Inventor 2012 version of your drawing.



Mike Deck
Software Developer
DLS - Mechanical Design
Autodesk, Inc.

Valued Mentor
stephengibson76
Posts: 1,112
Registered: ‎08-01-2006
Message 18 of 20 (1,101 Views)

Re: iLogic to set iProperty date

05-12-2011 08:37 AM in reply to: MjDeck

doh...

 

thankyou very much for your help

Stephen Gibson



View stephen gibson's profile on LinkedIn


Contributor
hardingster
Posts: 17
Registered: ‎06-02-2009
Message 19 of 20 (1,082 Views)

Re: iLogic to set iProperty date

05-19-2011 07:16 PM in reply to: MjDeck

I have a simlilar issue with iLogic trying to retreive a date from an excel spreadsheet but it keeps returning the number and not as the date. How do I change the number back to the date?

I have the excel populating custom fields in the iProperties, all other work well but this is the only one that keeps defaulting the cell type from text to number everytime.

I try and change everything to text, even in the excel sheet but this always comes back to a number in the iproperties and displays the number.

Here is the line in the iLogic rule:

iProperties.Value("Custom", "REV_A/1_DATE") = GoExcel.CurrentRowValue("REV_A/1_DATE")

 

Do you have any suggestions on how I would rectify this problem?

 

Thanks

Employee
MjDeck
Posts: 959
Registered: ‎02-24-2009
Message 20 of 20 (1,068 Views)

Re: iLogic to set iProperty date

05-19-2011 08:54 PM in reply to: hardingster

The function DateTime.FromOADate will get the date:

iProperties.Value("Custom", "REV_A/1_DATE") =  DateTime.FromOADate(GoExcel.CurrentRowValue("REV_A/1_DATE"))

 



Mike Deck
Software Developer
DLS - Mechanical Design
Autodesk, Inc.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.