I am trying to create a sketch symbol with info about the first view on a sheet. It seems to work fine with any of the properties built in, but I am trying to incude the scale. There are lots of posts about putting scale in a titeblock, but I can't seem to get the same code to work for a sketch symbol.
Any suggestions?
Dim strScale As String = ActiveSheet.View("VIEW1").ScaleString iProperties.Value("custom", "1st view scale") = strScale
This one will create a custom iProperty in the document, with the name of "1st view scale".
I'm no expert, but from what I know, you have to create that iProperty first, in order to use it in a sketch symbol.
What you do is to add text to your sketched symbol, and then instead of writing something, you throw in a custom iProperty.
The code above only works if you have a view named VIEW1, but you can switch that part to whatever you name your views
Thanks. That sounds like exactly what I want. Where am I supposed to put that code? I made it a rule, and it errored outs saying "End of statement expected." I tried adding an "End" function and that didn't work.
If I can get an iProperty then I can get it into the sketch no problem.
'If ActiveSheet.View=("VIEW1") Then Dim strScale As String = ActiveSheet.View("VIEW1").ScaleString iProperties.Value("custom", "1st view scale") = strScale 'end if
That's odd. I left out part of the code that was commented out.
I'm no wizard, but if this doesn't work, try removing the apostrophes.
Hmmm. I tried without the apostrophes and it popped 2 error codes:
Error on Line 1 : Argument not specified for parameter 'viewName' of 'Public ReadOnly Property View(viewName As String) As Autodesk.iLogic.Interfaces.ICadDrawingView'.
Error on Line 1 : End of statement expected.
Sorry this is a pain. I really appreciate the help. It would be nice if autodesk had sheet scale property so we didn't have to fake it.
Can you post a drawing file with the rule attached ? (Not an external rule)
I'd like to see what you're seeing 🙂