Dimscale

#1
John,

1. How do I retrieve the current drawing dimscale value (vba method)?

2. How do I change the dimscale value and then update the drawing with the changed value?

3. In creating a form and using a combobox with two columns I noticed that vba will not accept a columnwidth of 0 (zero) to hide a column. I have to use a small number such as 0.1 instead. Is this a bug?? Excel will accept a zero value.

Thank you,

Scott

#2
Figured out how to access "dimscale"

Private Sub CommandButton1_Click()

Set myapp = IntelliCAD.Application
Set mydoc = IntelliCAD.ActiveDocument
sysvarname = "dimscale"

mydimscale = 50
sysvardata = mydimscale

mydoc.SetVariable sysvarname, sysvardata

TextBox1 = mydoc.GetVariable(sysvarname)

End Sub


VBA is a little different than what I am used to.

This takes care of questions 1 & 2. Question 3 still remains.

Thank you,

Scott

Will Post complete routine when done

[This message has been edited by Scott (edited 01-26-2002).]

#3
For all to use to change drawing dimscale (Text size, dimension global scale factor for different plot scales)

Code as follows:

<B>Option Explicit

Dim myapp As intellicad.Application
Dim mydoc As intellicad.Document
Dim mydimscale As Double
Dim mytxtsize As Double
Dim mytxtmultiply As Double
Dim dsvardata As Double
Dim dsvarname As String
Dim duvardata As Long
Dim duvarname As String
Dim txtvarname As String
Dim txtvardata As Double

Private Sub cmd075ht_Click()
mytxtmultiply = 0.75

End Sub
Private Sub cmd100ht_Click()
mytxtmultiply = 1

End Sub

Private Sub cmd125ht_Click()
mytxtmultiply = 1.125

End Sub

Private Sub cmdCancel_Click()

End ' When the user selects the Cancel Button the program ends
End Sub

Private Sub cmdARCH_Click()
cboDIMSC.Clear 'Clears cbodimsc combobox of any entries

Call archunits
End Sub

Private Sub cmdCivil_Click()
cboDIMSC.Clear

Call civilunits
End Sub

Private Sub UserForm_Initialize()
cmdARCH.GroupName = "units" 'Isolates option button to group units
cmdCivil.GroupName = "units" 'Isolates option button to group units
cmd075ht.GroupName = "txtht" 'Isolates option button to group txtht
cmd100ht.GroupName = "txtht" 'Isolates option button to group txtht
cmd125ht.GroupName = "txtht" 'Isolates option button to group txtht



Set myapp = intellicad.Application
Set mydoc = intellicad.ActiveDocument
dsvarname = "dimscale"
duvarname = "dimunit"
txtvarname = "textsize"

cmd100ht.Value = "true" 'Sets 0.1" text height option button as default

Select Case mydoc.GetVariable(duvarname) 'Find value of current dimunit variable
Case 1, 2, 3, 5, 7 'Dimunit value
cmdCivil.Value = "true" 'Sets civil option button

GoTo civil

Case 4, 6 'Dimunit value
cmdARCH.Value = "true" 'sets architectural option button

GoTo architectural

End Select

architectural:
Select Case mydoc.GetVariable(dsvarname) 'Get current dimscale
Case 1
txtCDIMSC = "Full Scale 1:1" 'The textual label
cboDIMSC.Text = txtCDIMSC
Case 192
txtCDIMSC = "1/16" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.Text = txtCDIMSC
Case 128
txtCDIMSC = "3/32" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.Text = txtCDIMSC
Case 96
txtCDIMSC = "1/8" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.Text = txtCDIMSC
Case 64
txtCDIMSC = "3/16" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.Text = txtCDIMSC
Case 48
txtCDIMSC = "1/4" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.Text = txtCDIMSC
Case 32
txtCDIMSC = "3/8" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.Text = txtCDIMSC
Case 24
txtCDIMSC = "1/2" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.Text = txtCDIMSC
Case 16
txtCDIMSC = "3/4" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.Text = txtCDIMSC
Case 12
txtCDIMSC = "1" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.Text = txtCDIMSC
Case 8
txtCDIMSC = "1-1/2" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.Text = txtCDIMSC
Case 4
txtCDIMSC = "3" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.Text = txtCDIMSC
End Select

civil:
Select Case mydoc.GetVariable(dsvarname) 'Get current dimscale
Case 120
txtCDIMSC = "1" & Chr(34) + "= 10'" 'The textual label
cboDIMSC.Text = txtCDIMSC
Case 240
txtCDIMSC = "1" & Chr(34) + "= 20'"
cboDIMSC.Text = txtCDIMSC
Case 360
txtCDIMSC = "1" & Chr(34) + "= 30'"
cboDIMSC.Text = txtCDIMSC
Case 480
txtCDIMSC = "1" & Chr(34) + "= 40'"
cboDIMSC.Text = txtCDIMSC
Case 600
txtCDIMSC = "1" & Chr(34) + "= 50'"
cboDIMSC.Text = txtCDIMSC
Case 720
txtCDIMSC = "1" & Chr(34) + "= 60'"
cboDIMSC.Text = txtCDIMSC
Case 1200
txtCDIMSC = "1" & Chr(34) + "= 100'"
cboDIMSC.Text = txtCDIMSC
End Select

End Sub

Sub archunits()

architectural:
cboDIMSC.AddItem 1 'Adding the dimscale multiplier to combobox (cbodimsc)
cboDIMSC.List(0, 1) = "Full Scale 1:1" 'The textual label to combobox corresponding to item 1
cboDIMSC.AddItem 192 'Adding the dimscale multiplier
cboDIMSC.List(1, 1) = "1/16" & Chr(34) + "= 1'-0" & Chr(34) 'The textual label
cboDIMSC.AddItem 128
cboDIMSC.List(2, 1) = "3/32" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.AddItem 96
cboDIMSC.List(3, 1) = "1/8" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.AddItem 64
cboDIMSC.List(4, 1) = "3/16" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.AddItem 48
cboDIMSC.List(5, 1) = "1/4" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.AddItem 32
cboDIMSC.List(6, 1) = "3/8" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.AddItem 24
cboDIMSC.List(7, 1) = "1/2" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.AddItem 16
cboDIMSC.List(8, 1) = "3/4" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.AddItem 12
cboDIMSC.List(9, 1) = "1" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.AddItem 8
cboDIMSC.List(10, 1) = "1-1/2" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.AddItem 4
cboDIMSC.List(11, 1) = "3" & Chr(34) + "= 1'-0" & Chr(34)
cboDIMSC.TextColumn = 2
End Sub
Sub civilunits()

civil:
cboDIMSC.AddItem 120 'Adding the dimscale multiplier to combobox (cbodimsc)
cboDIMSC.List(0, 1) = "1" & Chr(34) + "= 10'" 'The textual label to combobox corresponding to item 1
cboDIMSC.AddItem 240 'Adding the dimscale multiplier
cboDIMSC.List(1, 1) = "1" & Chr(34) + "= 20'" 'The textual label
cboDIMSC.AddItem 360
cboDIMSC.List(2, 1) = "1" & Chr(34) + "= 30'"
cboDIMSC.AddItem 480
cboDIMSC.List(3, 1) = "1" & Chr(34) + "= 40'"
cboDIMSC.AddItem 600
cboDIMSC.List(4, 1) = "1" & Chr(34) + "= 50'"
cboDIMSC.AddItem 720
cboDIMSC.List(5, 1) = "1" & Chr(34) + "= 60'"
cboDIMSC.AddItem 1200
cboDIMSC.List(6, 1) = "1" & Chr(34) + "= 100'"
cboDIMSC.TextColumn = 2
End Sub
Private Sub cbodimsc_Click()
Select Case cboDIMSC.Value
Case 120, 240, 360, 480, 600, 720, 1200
mytxtsize = cboDIMSC.Value * mytxtmultiply / 120 'Sets text height to 0.1" high for selected Scale
Case 1, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192
mytxtsize = cboDIMSC.Value * mytxtmultiply / 10 'Sets text height to 0.1" high for selected Scale

End Select
End Sub

Private Sub cmdok_click()

mydimscale = cboDIMSC.Value
dsvardata = mydimscale
txtvardata = mytxtsize
mydoc.SetVariable dsvarname, dsvardata 'Changes Drawing Dimscale
mydoc.SetVariable txtvarname, txtvardata 'Changes Drawing Text Height

Unload frmDrawingScale

End Sub</B>

Comments welcome

Scott

(do not have a url to post screen shot of form)