TurboCAD Forums

The Ultimate Resource for TurboCAD Knowledge

Register
 
The purpose of these forums is to discuss TurboCAD.  Please keep the discussion of other products to compatibility issues or how the other software’s can be used with TurboCAD.


How to Fill Shape
Read 7571 times
* February 17, 2010, 05:45:52 AM
Hi Everyone,
I'm having some trouble filling a cirlce. Ideally i'd like to set the fill to solid, and then set the colour to be set by layer.
I've no idea where to start with this one, possibly by setting properties for the shape...

Code: [Select]
Set props = grf.Properties
props.Item("$FILL").Value = 1
props.Item("$COLOR").Value = 0

???

I've tried a few things but no luck as yet, any help will be a greatly appreciated.
Cheers
Mike at Crowns

Logged


* February 17, 2010, 03:06:13 PM
#1
props.Item("BrushStyle").Value = "Solid"
props.Item("BrushColor").Value = 255

or, to use a named color
props.Item("BrushColor").Value = app.NamedColors.Item("Red").Color

Logged


* February 17, 2010, 03:18:03 PM
#2
Mike, one thing I have found to be invaluable is the ability to examine the properties and vertices of an existing object. Have you looked at this sample VB 2008 project? It will let you do a complete dump of the properties and points of an entire drawing. I use it a lot on simple drawings that just contain one or two items that I'm trying to create via the SDK -- it helps me figure out what properties are available for that type of object, and figure out if I need to add any to my code.

http://forums.turbocad.com/index.php/topic,600.0.html

Logged


* February 17, 2010, 03:54:48 PM
#3
re: ...and then set the colour to be set "By Layer".

Would "-3" (minus 3) work here? That's what is used in TCExplorer when I want to set Pen Color to By Layer.

Logged
John R.

V17—V21, 2015—2018
Designer, Deluxe, Expert, Basic, Platinum
RedSDK enabled
Windows 10, 64-bit


* February 17, 2010, 04:11:32 PM
#4
D'oh! Thanks John!

"-3" indeed, for my reading comprehension! Yes, to set the color by layer, use -3.

props.Item("BrushStyle").Value = "Solid"
props.Item("BrushColor").Value = -3

Logged


* February 17, 2010, 04:48:22 PM
#5
Here are the other numbers:
Select Pen Color
0=Black,
-3=By Layer,
-4=By Block,
-5=By Pen

There is a TurboCAD Colors chart on this Wiki page that has decimal numbers for the different colors.
Color Palette

Logged
John R.

V17—V21, 2015—2018
Designer, Deluxe, Expert, Basic, Platinum
RedSDK enabled
Windows 10, 64-bit