Author Topic: TrueColor dialog  (Read 2587 times)

0 Members and 1 Guest are viewing this topic.

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
TrueColor dialog
« on: May 24, 2006, 11:14:48 AM »
Does somebody know how to call the TrueColor dialog from VBA, like 'acad_truecolordlg' in LISP?
I know there is an API for the ACI color dialog, but can't find something similar for TrueColor.
A2k7...

TIA
Jürg
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

fxcastil

  • Guest
Re: TrueColor dialog
« Reply #1 on: May 27, 2006, 04:18:01 PM »
Here are the 3 ways I know about



Option Explicit
Public Declare Function acedSetColorDialog Lib "acad.exe" (color As Long, ByVal bAllowMetaColor As Boolean, ByVal nCurLayerColor As Long) As Boolean

Sub test()

  Dim lngInitClr As Long
  Dim blnMetaColor As Boolean
  Dim lngCurClr As Long

  On Error Resume Next

    If acedSetColorDialog(lngInitClr, blnMetaColor, lngCurClr) Then
       MsgBox lngInitClr
   End If


End Sub





Public Function ColorDialog() As Integer

Dim intVariable As Integer

If Connect Then
objAcad.Application.WindowState = acMin
'calls the acad color dialog and returns
'the index of the color selected or -1 if cancelled
'store current sysvar value
intVariable = ThisDrawing1.GetVariable("USERI5")
'call color dialog
ThisDrawing1.SendCommand ("(setq clr (acad_colordlg 1))" & vbCr)
ThisDrawing1.SendCommand ("(if (= clr nil)" & _
"(setvar ""USERI5"" -1)" & _
"(setvar ""USERI5"" clr))" & vbCr)
ColorDialog = ThisDrawing1.GetVariable("USERI5")
'reset sysvar
ThisDrawing1.SetVariable "USERI5", intVariable
End If


Fred Castillo





Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: TrueColor dialog
« Reply #2 on: May 29, 2006, 02:29:10 AM »
Thank you Fred...
I have not a problem with calling the ACI color dialog from AutoCAD's VBA, rather with calling the TrueColor dialog in A2k4+.

Quote
Here are the 3 ways I know about
And the third way?... :-)

Cheers
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18


Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: TrueColor dialog
« Reply #4 on: May 29, 2006, 11:39:29 AM »
I will give those a try, thanks Fred.
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18