03.06.2008 12:12    

tralles
Acad vba ile aşağıdaki şekilde ölçülendirme stili oluşturdum.

Set OlcuStili = ThisDrawing.DimStyles.Add("....")

Fakat bu oluşturulan ölçü stilini modifiye edemiyorum. (Yazı yüksekliğini, ölçülendirme rengini vs.)

Yardımcı olursanız sevinirim.

Kolay gelsin

05.06.2008 16:22    

biolight
Merhaba,
Yeni bir TextStyles oluşturup
bu TextStyles i oluşturduğun DimStyles e ataman( DIMTXSTY) gerekli.

Veya
yeni DimStyles değil de AcadDimAligned gibi bir DimObje si oluştur ken
yazı yüksekliği ve rengi gibi detayları ayarlayabilirsin
tabi bunda tek tek ayarlamak gerekecek
örnek helpin içinde vardı sadece renk ve yükseklik ekledim.
Kod:

Sub Example_AddDimAlignedColor()
Dim dimObj As AcadDimAligned
Dim point1(0 To 2) As Double
Dim point2(0 To 2) As Double
Dim location(0 To 2) As Double

point1(0) = 5#: point1(1) = 5#: point1(2) = 0#
point2(0) = 10#: point2(1) = 5#: point2(2) = 0#
location(0) = 5#: location(1) = 7#: location(2) = 0#

Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
dimObj.TextColor = acGreen
dimObj.TextHeight = 0.5
End Sub

Kolay gelsin.

07.06.2008 11:32    

tralles
Sn biolight

ilgine teşekkür ederim. Söylediğiniz gibi dim objesinden özelliklerini değiştirmek oldukça zahmetli.
Aslında benim sorumda dimstyle nasıl değiştirebileceğimize yönelikti.
O da sistem değişkenlerini değiştirmekten geçiyormuş.
Nette tam bununla ilgili bir dvb dosyası buldum kodunu paylaşmak istiyorum.

Kod:

Sub adAddDimStyle()
  Dim adDimStyle As AcadDimStyle

  Set adDimStyle = ThisDrawing.DimStyles.Add("adDimStyle")
  ThisDrawing.ActiveDimStyle = adDimStyle

  With ThisDrawing
  'The first group defines overall and linear scale factors
    .SetVariable "DimScale", 96    'Overall Scale Factor. Determined by 12/Scale Factor.
                                   '  96 is for 1/8"=1'-0" so that 12/.125=96.
    .SetVariable "DimLFac", 1      'Linear Scale Factor. '1'=1:1, '2'=2:1,'.5'=1:2, etc

  'This group defines the typical dimension properties
    .SetVariable "DimADec", 2      'Precision places for angular dimensions. May be 0-8.
    .SetVariable "DimAso", 1       'Dimensional associativity. 0=off, 1=on. 0 'explodes' dimensions.
                                   '  DimAso is stored by drawing, not by style.
    .SetVariable "DimASz", 0.09375 'Arrowhead size for dimensions and leaders.
    .SetVariable "DimAtFit", 1     'Defines placement of arrowheads and text if insufficient space for both.
                                   '  0=both outside, 1=force arrows outside, 2=force text outside, 3=best fit.
    .SetVariable "DimAUnit", 0     'Units for angular dimensions.
                                   '  0=decimal degrees, 1=degrees/minutes/seconds, 2=gradians, 3=radians
    .SetVariable "DimAZin", 0      'Zero suppression for angular dimensions.
                                   '  0=display all leading and trailing zeros, 1=suppress leading zeros,
                                   '  2=suppress trailing zeros, 3=suppress leading and trailing zeros
    .SetVariable "DimBlk", ""      'Defines typical arrow type. ' "" '=Closed-Filled, '.'=none.
                                   '  Others are:  '_ArchTick', '_BoxBlank', '_BoxFilled', '_Closed', '_ClosedBlank',
                                   '  '_DatumBlank', '_DatumFilled', '_Dot', '_DotSmall', '_DotBlank', '_Integral',
                                   '  '_None', '_Oblique', '_Origin', '_Origin2', '_Open', '_Open90', '_Open30', '_Small'.
    .SetVariable "DimBlk1", ""     'Defines 1st arrow type if 'DimSAH is '1'. See 'DimBlk' for type list.
    .SetVariable "DimBlk2", ""     'Defines 1st arrow type if 'DimSAH is '2'. See 'DimBlk' for type list.
    .SetVariable "DimCen", 0.09375 'Defines circle and arc center marks and lines. Show as mark size.
                                   '  0=No marks, <0=centerlines are drawn, >0=centermarks are drawn.
    .SetVariable "DimClrD", 256    'Color for dimlines, arrows, and leaders. 0=ByBlock, 256 = ByLayer, 1-255=color.
    .SetVariable "DimClrE", 256    'Color for dimension extension lines. 0=ByBlock, 256 = ByLayer, 1-255=color.
    .SetVariable "DimClrT", 256    'Color for dimension text. 0=ByBlock, 256 = ByLayer, 1-255=color.
    .SetVariable "DimDec", 4       'Decimal precision for normal dimensions.
    .SetVariable "DimDLE", 0       'For oblique marks in place of arrows: Distance dimlines extend beyond extension lines.
    .SetVariable "DimDLI", 0.3125  'Offset distance between dimension line rows.
    .SetVariable "DimDSep", "."    'Decimal separator for decimal format dimensions.
    .SetVariable "DimExe", 0.0625  'Extension distance of extension lines beyond dimension lines.
    .SetVariable "DimExO", 0.0625  'Offset distance from dimension origin to extension line.
    .SetVariable "DimFrac", 0      'Fraction format in fractional dimensions. 0=Horizontal, 1=diagonal, 2=not stacked.
    .SetVariable "DimGap", 0.015625 'Gap between dimlines and dimension text.
    .SetVariable "DimJust", 0      'Dimension text horizontal position. 0=Centered between extension lines,
                                   '  1=at 1st extension line, 2=at 2nd extension line, 3=above and at 1st extension line,
                                   '  4=above and at 2nd extension line.
    .SetVariable "DimLdrBlk", ""   'Defines leader arrow type. See DimBlk for type list.
    .SetVariable "DimLim", 0       'Defines whether dimension limits are generated. 1=On, 0=Off.
    .SetVariable "DimLUnit", 4     'Defines dimension unit types(except angular). 1=Scientific, 2=Decimal, 3=Engineering,
                                   '  4=Architectural, 5=Fractional, 6=Windows default
    .SetVariable "DimLwd", acLnWtByLayer 'Defines dimension line lineweight. 'ByBlock'=acLnWtByBlock, 'ByLayer'=acLnWtByLayer,
                                         '  also may be specified as millimeters.
    .SetVariable "DimLwe", acLnWtByLayer 'Defines extension line lineweight. 'ByBlock'=acLnWtByBlock, 'ByLayer'=acLnWtByLayer,
                                         '  also may be specified as millimeters.
    .SetVariable "DimPost", ""     'Defines dimension text prefix or suffix. Use brackets to specify prefix or suffix.
                                   '  '<>ft' will create a suffix of 'ft', while 'ft<>' will create a prefix of 'ft'.
    .SetVariable "DimRnd", 0       'Defines precision for rounding dimensions. '.5' will round to nearest half.
    .SetVariable "DimSAh", 0       'Defines arrowhead block display. 0=set per 'DIMBLK'(see 'DimLdrBlk' for list'),
                                   '  1=sets arrowhead 1('DIMBLK1') independently of arrowhead 2('DIMBLK2')(see 'DimLdrBlk' for list').
    .SetVariable "DimSD1", 0       'Defines display of 1st dimline and arrowhead. 0=Display, 1=Do not display.
    .SetVariable "DimSD2", 0       'Defines display of 2nd dimline and arrowhead. 0=Display, 1=Do not display.
    .SetVariable "DimSE1", 0       'Defines display of 1st extension line. 0=Display, 1=Do not display.
    .SetVariable "DimSE2", 0       'Defines display of 2nd extension line. 0=Display, 1=Do not display.
    .SetVariable "DimSho", 1       'Defines dynamic update of dimtext as defining points are dragged. 0=Update, 1=Do not update.
                                   '  DimSho is stored by drawing, not by style.
    .SetVariable "DimSOXD", 0      'Defines whether dimlines are drawn outside of extension lines.
                                   '  0=Drawn outside, 1=Not drawn outside.
    .SetVariable "DimTAD", 0       'Dimension text vertical position. 0=Centered between extension lines,
                                   '  1=above the dimension line, 2=dimensions placed on side of dimline away from defining points,
                                   '  3=placed according to Japanese Industrial Standards.
    .SetVariable "DimTIH", 0       'Defines position of dimtext between extension lines. 0=Align with dimline, 1=Always horizontal.
    .SetVariable "DimTIX", 0       'Defines how text is placed between extension lines. 0=Between if fits, 1=Always between.
    .SetVariable "DimTOFL", 0      'Defines how dimline is placed between extension lines. 0=In or out with arrowheads, 1=Always between.
    .SetVariable "DimTOH", 0       'Defines position of dimtext outside extension lines. 0=Align with dimline, 1=Always horizontal.
    .SetVariable "DimTSz", 0       'Defines size of Oblique strokes in place of arrowheads. 0=Draws arrowheads, >0=Oblique size.
    .SetVariable "DimTVP", 0
    .SetVariable "DimTxSty", "STANDARD"
    .SetVariable "DimTxt", 0.09375
    .SetVariable "DimUPT", 0
    .SetVariable "DimZIn", 0

  'This group defines the Alternate dimension properties
    .SetVariable "DimAlt", 0
    .SetVariable "DimAltD", 4
    .SetVariable "DimAltF", 25.4
    .SetVariable "DimAltRnd", 0
    .SetVariable "DimAltTD", 4
    .SetVariable "DimAltTZ", 0
    .SetVariable "DimAltU", 2
    .SetVariable "DimAltZ", 0
    .SetVariable "DimAPost", ""

  'This group defines the Tolerance dimension properties
    .SetVariable "DimTol", 0
    .SetVariable "DimTDec", 4
    .SetVariable "DimTFac", 1
    .SetVariable "DimTM", 0
    .SetVariable "DimTolJ", 1
    .SetVariable "DimTP", 0
    .SetVariable "DimTZin", 0
  End With

  adDimStyle.CopyFrom ThisDrawing
End Sub


Başka sorularla görüşmek üzere...

07.06.2008 23:04    

biolight
Merhaba,

Ben Text leri kontrol için yeni TextStyles oluşturup bunu
ThisDrawing.SetVariable "DimTxSty", "Yeni Text Style"
ile atamayı düşünmüştüm

Yukarıda ki örnekte TextStyles olarak STANDARD atanmış
ThisDrawing.SetVariable "DimTxSty", "STANDARD"
Text renkleri ise
DimClrTile tekil olarakta renk atanabiliyormuş

Örnek te bütün Dim ayarları verilmiş
Güzel döküman yakalamışsın ;)

Kolay gelsin.

Düzeltme :
Pardon text style ile yazı Yüksekliği ve benzeri ayarları yapabiliyoruz
Dimde ki text renk ayarı için direk DimClrT a müdahale etmek gerekliymiş

biolight (07.06.2008 23:12 GMT)

> 1 <
Copyright © 2004-2022 SQL: 0.571 saniye - Sorgu: 54 - Ortalama: 0.01058 saniye