News:

Be sure your post is relevant to the current discussion.  Create a new topic within the appropriate board if you are unsure.

Main Menu

How to Fill Shape

Started by MikeCrown, February 17, 2010, 05:45:52 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

MikeCrown

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...

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

kchapman

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

kchapman

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

John R

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.
John R.

V17—V21, 2015—2025
Designer, Deluxe, (Basic, Expert, Professional), Platinum
RedSDK enabled
Windows 11 Pro (25H2), 64-bit

kchapman

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

John R

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
John R.

V17—V21, 2015—2025
Designer, Deluxe, (Basic, Expert, Professional), Platinum
RedSDK enabled
Windows 11 Pro (25H2), 64-bit