Color Dialog

Color Dialog

Anonymous
Not applicable
429 Views
6 Replies
Message 1 of 7

Color Dialog

Anonymous
Not applicable
Hi folks,
Are the AutoCAD Color, Lineweight and Linetype dialogs available from VBA?
Sure be nice to find this!

Thanks
Serge
0 Likes
430 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Hi,

Yes.

However, for normal programming purposes you will be trying to avoid them.
See the discussion above.

--


Laurie Comerford
CADApps
www.cadapps.com.au

"Serge Olivier" wrote in message
news:214F409936470CCB5496A6B3981C712F@in.WebX.maYIadrTaRb...
> Hi folks,
> Are the AutoCAD Color, Lineweight and Linetype dialogs available from VBA?
> Sure be nice to find this!
>
> Thanks
> Serge
>
>
0 Likes
Message 3 of 7

Anonymous
Not applicable
I haven't the slightest Idea what Laurie is talking
about, but I use them quite a bit. They're not available
from VBA directly, but you can use the Visual LISP ActiveX
interface to get the color dialog. For the other two, the
only way I know of is by using AcadX (which you can find
at www.caddzone.com/acadx).

See the DrawingEditor class.

--
AcadXTabs: Document Tabs for AutoCAD
http://www.acadxtabs.com


"Serge Olivier" wrote in message news:214F409936470CCB5496A6B3981C712F@in.WebX.maYIadrTaRb...
> Hi folks,
> Are the AutoCAD Color, Lineweight and Linetype dialogs available from VBA?
> Sure be nice to find this!
>
> Thanks
> Serge
>
>
0 Likes
Message 4 of 7

Anonymous
Not applicable
Tony Tanzillo wrote:

> See the DrawingEditor class.

Is that available for AutoCAD 2004?

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
0 Likes
Message 5 of 7

Anonymous
Not applicable
You can use the AsdkUnsupp2004.arx  (has
been updated for 2004)

Below is an example in VBA.

 

 

Dim dialog As AsdkUNSUPP2004Lib.Application
LoadUnsupp
Set dialog =
Application.GetInterfaceObject("Asdkunsupp2004.Application.1")

 

'Displays Open dialog
Dim open_file As String
open_file =
dialog.ShowOpenDialog("Open this file", "C:\program files\Acad2004",
"dwg")
Application.Documents.Open open_file

 

'Displays Lineweight dialog
aclw =
dialog.ShowLineWeightDialog(acLnWt040,
0)
ThisDrawing.Layers.Item("0").Lineweight = aclw

 

'Displays Linetype dialog
Dim ltype As AcadLineType
Dim aclt As
AcadLineType
ThisDrawing.Linetypes.Load "Hidden", "acad.lin"
Set ltype =
ThisDrawing.Linetypes.Item("Hidden")
Set aclt =
dialog.ShowLinetypeDialog(ltype, 0)
ThisDrawing.Layers.Item("0").Linetype =
aclt.Name

 

'Displays Hatch patterns dialog
Dim ocir(0) As AcadCircle
Dim cp(0 To
2) As Double
Dim rad As Double
Dim hpattern As String
Dim ohatch As
AcadHatch
cp(0) = 5
cp(1) = 5
cp(2) = 0
rad = 4
Set ocir(0) =
ThisDrawing.ModelSpace.AddCircle(cp, rad)
ocir(0).Update
hpattern =
dialog.ShowHatchPalletteDialog("ANSI31", 0)
Set ohatch =
ThisDrawing.ModelSpace.AddHatch(acHatchPatternTypePreDefined, hpattern,
True)
ohatch.AppendOuterLoop ocir
ohatch.Evaluate

 

'Displays Color dialog
Dim clr As Long
clr =
dialog.ShowColorDialog(acGreen, 1)
ohatch.Color = clr

 

'Displays the current shademode as a integer
ThisDrawing.SendCommand
"shademode G "
MsgBox dialog.ShadeMode

 


'Displays Save file dialog
Dim save_file As String
save_file =
dialog.ShowSaveDialog("Save this file as", "temp", "dwg")
ThisDrawing.SaveAs
save_file
Save


--
Saludos,  Ing. Jorge Jimenez,
SICAD S.A., Costa Rica

 

 

> Hi
folks,
> Are the AutoCAD Color, Lineweight and Linetype dialogs available
from VBA?
> Sure be nice to find this!
>
> Thanks
>
Serge
>
>
0 Likes
Message 6 of 7

Anonymous
Not applicable
Frank Oquendo wrote:

> Is that available for AutoCAD 2004?

After looking at the web site, I believe the answer is 'no'.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
0 Likes
Message 7 of 7

Anonymous
Not applicable
I have found a copy of AsdkUnsupp2004.arx. I am using the RevokeAutoCAD and RegisterAutoCAD functions to try to determine which instance of AutoCAD my executable has been launched from. The Revoke method works fine for me, but the RegisterAutoCAD method seems to be registering my AutoCAD apps into the Running Objects Table as a R14 application, so subsequent calls to this fail to work. Does anyone have any idea why this happens or can suggest a workaround for it?
0 Likes