Hej
I would like to rotate existing Sketched Symbol with iLogic. I can scale it with this code, but I can't use the same to rotate.
For Each sketched As SketchedSymbol In oSheet.SketchedSymbols
If (sketched.Name = "Snit_C") Then
sketched.Scale = 2
sketched.Rotate = 30
End If
Next
It get error:
Error in rule: SymbolRul, in document: TS_FG_BR.idw
Det offentlige medlem 'Rotate' i typen 'SketchedSymbol' blev ikke fundet.
If anyone can help. It will be nice.
Lilia
Solved! Go to Solution.
Solved by LiliaE. Go to Solution.
Solved by philippe.leefsma. Go to Solution.
The correct spelling of the property is "Rotation" and not "Rotate".
Check the Help Files in case of a doubt.
Regards,
Philippe.
I want to achieve something very similar. I have a symbol on my drawing and I want a rule to change it's scale to match the scale of another view I have
Something like this:
SymbolScale ("Scaled Man") = ActiveSheet.View(View(2)).ScaleString
So far I have copy pasted what you have, see below but get errors
For Each sketched As SketchedSymbol In oSheet.SketchedSymbols If (sketched.Name = "Scaled Man") Then sketched.Scale = 2
sketched.Rotation = 30 End If Next
I'm very new to iLogic so don't really understand these errors:
Error on Line 1 : Type 'SketchedSymbol' is not defined.
Error on Line 1 : 'oSheet' is not declared. It may be inaccessible due to its protection level.
Maybe there's something even simpler I could do?
For Each oSheet As Sheet in ThisApplication.ActiveDocument.Sheets
For Each sketched As SketchedSymbol In oSheet.SketchedSymbols If (sketched.Name = "Scaled Man") Then sketched.Scale = 2
sketched.Rotation = 30 End If Next
Next
Untested, but should work. You were missing the declaration for oSheet, as the plain english in the error stack suggests. oSheet needs a declaration as it is a variable created by the user and not native to the API.
Thanks for that explanation, it works perfect now for that appliction.
I've encountered another issue however, I want my sketched symbol scale to be set the same as another drawing view scale.
I have the following code but get this error: "Conversion from string "1/15.25" to type 'Double' is not valid."
For Each oSheet As Sheet In ThisApplication.ActiveDocument.Sheets For Each sketched As SketchedSymbol In oSheet.SketchedSymbols If (sketched.Name = "Scaled Man") Then sketched.Scale = ActiveSheet.View("ELEVATION").ScaleString End If Next Next
How can I convert this to a 'double'?
I have this piece of code which applies the scale from one view to another, which I've tried to use in a similar way above. However I understand in this instance it's simpler as I'm going from string to string.
ActiveSheet.View("PERSPECTIVE").ScaleString = ActiveSheet.View("ELEVATION").ScaleString
Soke too soon. No error when I remove the word 'String' from this line
sketched.Scale = ActiveSheet.View("ELEVATION").Scale