Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
dypro
in reply to: WCrihfield

hello @WCrihfield 

I tried the code, but just to get an error again.
I copy paste it here:

System.InvalidCastException: La conversión de la cadena "" en el tipo 'Date' no es válida.
en Microsoft.VisualBasic.CompilerServices.Conversions.ToDate(String Value)
en ThisRule.Main()
en Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
en iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

First line means "the conversion of the string "" into 'Date' type is not valid"

 

I think that what is failing is that in the autocad block the "SH_DATE_MODIF" may have a date, but often will be empty, and the 'date' type cannot handle the "" value?

I tried:

Case "SH_DATE_MODIF"
						Try : oCProp = oCProps.Item("FECHA REVISION")
						If oCProp = "" Then 
							Dim dModifDate As String = CDate(sValue)
						Else
							Dim dModifDate As Date = CDate(sValue)
						End If
						Catch : oCProp = oCProps.Add(dmodifdate, "FECHA REVISION") : End Try
						If oCProp.Value <> dModifDate Then Try : oCProp.Value = dModifDate : Catch : End Try

but something must be wrong with the syntax or something because it gives an error as well:

Compilation errors in the rule

the variable  'dModifDate' hides a variable in an inclusion block

or something like that (it's in spanish so I tried to translate it)

 

 

On the other hand, I did manage to make the sheets change color.

 

PD: I just noticed as well the need to delete a block witch may be named "MARCO2000" or "Copia de MARCO2000". I tried to replicate your code but I could not make it work.