News:

Interested in some really terrific mobile apps? Visit www.turboapps.com for details.

Main Menu
TurboCAD 2026 Platinum box
Now available

TurboCAD 2026.2

The latest update for TurboCAD 2026. It installs over any 2026 build and keeps your activation, drawings and settings. Get it from the Start Page or Help > Check for Update.

Automatic assignment of styles in connection to/as a function of a value?

Started by Michael2011, May 10, 2012, 12:43:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Michael2011

Hey folks,

just a thought: is it possible to automatically have styles (line style, dimensioning style etc.) assigned to objects depending on the value of an object?

I created two style for dimensions above and below 1, and I´d like to see them assigned automatically. Same would come in handy for lines of different lenghts, like sorting them by length and then assigning them specific colours.

Anyone already done this?


ibruethsch

Hi Michael
that should be possible with the SDK.
e.g. vbs in macrorecorder:
you have selected 10 lines
that one with length > 10 get the line style continous and that < 10  becomes  dash(Hidden)
---------------------------------------------
Dim ActiveDrawing
Set ActiveDrawing = Application.ActiveDrawing
Dim prop 'As Property
Dim i 'As Integer
For i = 0 To ActiveDrawing.Selection.Count - 1
Set gr = ActiveDrawing.Selection.Item(i)
On Error Resume Next
IF gr.Properties("M_Length").value <10 then gr.Properties("PenStyle").value = "HIDDEN"
if gr.Properties("M_Length").value  >10 then gr.Properties("PenStyle").value = "CONTINUOUS"
Next 'i
On Error Resume Next
set gr = nothing

------------------------------------------------
save as **.vbs and load in macrorecorder (.vbs not .tcr )

The dimensionstyle is not a nativ TC element. It was implemented in TC for compatibility reason with Autocad. In SDK it is not available.

Bernd