waitingyou 发表于 2004-12-17 14:01:00

Help me!怎样使用setcoustomscale方法

怎样使用setcoustomscale方法,望高手赐教

yulijin608 发表于 2004-12-17 14:32:00

<P class=Heading-2>语法
<P class=syntax>object.SetCustomScale(Numerator, Denominator)
<P class=element>Object


<P class=element-desc><A href="http://www.mjtd.com/object/acad2004/idh_layout_object.htm" target="_blank" >Layout</A>, <A href="http://www.mjtd.com/object/acad2004/idh_plotconfiguration_object.htm" target="_blank" >PlotConfiguration</A><BR>使用该方法的对象。
<P class=element>Numerator


<P class=element-desc>Double[双精度]; 仅用于输入<BR>用正数表示的比率中的分子。该值表示比例的英寸或毫米数。
<P class=element>Denominator


<P class=element-desc>Double[双精度]; 仅用于输入<BR>用正数表示的比率中的分母。该值表示比例的图形单位数。
<P class=Heading-2>说明
<P class=body>Numerator 参数的单位可在 <A href="http://www.mjtd.com/object/acad2004/idh_paperunits.htm" target="_blank" >PaperUnits</A> 属性中查到。
<P class=body>Numerator 和 Denominator 值必须大于 0。
<P class=body>该方法的产生的改动在图形重生成时不会显示。使用 <A href="http://www.mjtd.com/object/acad2004/idh_regen.htm" target="_blank" >Regen</A> 方法重生成图形。


<P class=body>Sub Example_SetCustomScale()<BR>                       ' This example will access the Layouts collection for the current drawing<BR>                       ' and list basic information about the custom scale for each Layout.<BR>                       ' It will then change the custom scale information for model space and re-display<BR>                       ' the scale information.<BR><BR>                       Dim Layouts As AcadLayouts, Layout As ACADLayout<BR>                       Dim msg As String<BR>                       Dim Numerator As Double, Denominator As Double<BR>                       Dim Measurement As String<BR>                       <BR>                       ' Display current scale information<BR>                       GoSub DISPLAY_SCALE_INFO<BR>                       <BR>                       ' Modify scale<BR>                       Numerator = 1<BR>                       Denominator = 1<BR>                       <BR>                       ThisDrawing.Layouts("Model").SetCustomScale Numerator, Denominator<BR>                       ThisDrawing.Regen acAllViewports<BR>                                                                                       <BR>                       ' Display new scale information<BR>                       GoSub DISPLAY_SCALE_INFO<BR>                                                       <BR>                       Exit Sub<BR>                       <BR>

<PRE class=Code>DISPLAY_SCALE_INFO:
    ' Get layouts collection from document object
    Set Layouts = ThisDrawing.Layouts
   
    msg = vbCrLf &amp; vbCrLf   ' Start with a space
   
    ' Get the scale information of every layout in this drawing
    For Each Layout In Layouts
      msg = msg &amp; Layout.name &amp; vbCrLf
      
      ' Get scale information
      Layout.GetCustomScale Numerator, Denominator
      
      ' Identify whether inches or millimeters are being used.
      Measurement = IIf(Layout.PaperUnits = acInches, " inch(es)", " millimeter(s)")
      
      ' Format for display
      msg = msg &amp; vbTab &amp; "Contains " &amp; Numerator &amp; Measurement &amp; vbCrLf
      msg = msg &amp; vbTab &amp; "Contains " &amp; Denominator &amp; " drawing units" &amp; vbCrLf
      msg = msg &amp; "_____________________" &amp; vbCrLf
      
    Next
   
    ' Display custom scale information
    MsgBox "Custom scale information for the current drawing is: " &amp; msg
   
    Return
End Sub</PRE>
页: [1]
查看完整版本: Help me!怎样使用setcoustomscale方法