• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Mentor
    Posts: 258
    Registered: ‎01-27-2010

    How to use correctly the PlotSettingsValidator

    137 Views, 2 Replies
    12-18-2012 08:34 AM

    I have a view on paper pace : Name "1200-900"  size : 1200 x 900 unit  (Unit : mm)

     

    my little prg vb.bet :

     

     

    .....
    
                    Dim tr As Transaction = db.TransactionManager.StartTransaction()
    
                    Using (tr)
                        'Dim bt As BlockTable = tr.GetObject(db.BlockTableId, OpenMode.ForRead)
                        Dim btr As BlockTableRecord = tr.GetObject(db.CurrentSpaceId, OpenMode.ForRead)
                        Dim lo As Layout = tr.GetObject(btr.LayoutId, OpenMode.ForRead)
    
    
    
                        Dim pi As PlotInfo = New PlotInfo()
                        pi.Layout = btr.LayoutId
    
    
                        '// We need a PlotSettings object
                        '// based on the layout settings
                        '// witch we then customize
    
    
    
                        Dim ps As PlotSettings = New PlotSettings(lo.ModelType)
                        ps.CopyFrom(lo)
    
                        '// The PlotSettingsValidator helps
                        '// create a valid PlotSettings object
    
                        Dim psv As PlotSettingsValidator = PlotSettingsValidator.Current
    
                        'retrieve the name of vue
                        Dim NomView As String = ChoixVue()
    
                        If NomView <> "" Then
                            psv.SetPlotViewName(ps, NomView) '"1200-900")
                            psv.SetPlotType(ps, Autodesk.AutoCAD.DatabaseServices.PlotType.View)
    
    
                            'HERE MY PROB !!
                            psv.SetPlotPaperUnits(ps, PlotPaperUnit.Millimeters)
                            
                            'psv.SetUseStandardScale(ps, True)
                            'psv.SetStdScaleType(ps, StdScaleType.StdScale1To50)
                            'Dim Scale As CustomScale = New CustomScale(1, 30)
                            'psv.SetStdScale(ps, 0.0)
                            'psv.SetCustomPrintScale(ps, Scale)
    
    
                            'psv.SetPlotCentered(ps, True)
                            'psv.RefreshLists(ps)
    
                            '***** Format paper
    
    
                            
                            psv.SetPlotConfigurationName(ps, "DWG To PDF(Ce).pc3", "UserDefinedMetric (900.00 x 1500.00mm)")
                            '// We need to link the PlotInfo to the
                            '// PlotSettings and then validate it
    
                            pi.OverrideSettings = ps
                            Dim piv As PlotInfoValidator = New PlotInfoValidator()
    
                            piv.MediaMatchingPolicy = MatchingPolicy.MatchEnabled
                            piv.Validate(pi)
    
    
                            If PlotFactory.ProcessPlotState = ProcessPlotState.NotPlotting Then
    
    
    .......

     I cant understand the :

    - psv.SetStdScaleType(ps, StdScaleType.xxxx)

    --> If i use 1to1 i dont see my drawing

    --> if i use 1to 20 i see my draw  

     

    but i want create a draw with exacty the size of my view. (The size is already finewith the paper of my DesignJet T610)

     

    So how i can just retrieve the good page layout. (CTRL+P and enter work fine)

     

    How is calculate the StdScaleType.StdScale1To50  or StdScaleType.StdScale1To1 ?

     

    Please use plain text.
    Mentor
    Posts: 258
    Registered: ‎01-27-2010

    Re: How to use correctly the PlotSettingsValidator

    12-18-2012 11:21 PM in reply to: AubelecBE
    psv.SetPlotPaperUnits(ps, PlotPaperUnit.Millimeters)
    Dim Scale As CustomScale = New CustomScale(1, 25.4)
    psv.SetCustomPrintScale(ps, Scale)

     

    I have now my correct size --> i have to scale the view with the ratio of 25.4 (Inche / mm)

     

    i have set my plotpaperunits to mm  but why i need to convert the scale to units inche ?

     

    why ?

    How i can set the corret units to mm ?

    Please use plain text.
    ADN Support Specialist
    Posts: 162
    Registered: ‎07-24-2007

    Re: How to use correctly the PlotSettingsValidator

    12-21-2012 01:59 PM in reply to: AubelecBE

    I'm not really a Plot expert, but what are the UNITS of the DWG setup to be?





    Fenton Webb

    Developer Technical Services

    Autodesk Developer Network


    Please use plain text.