Invalid Input when using SetCurrentStyleSheet

Invalid Input when using SetCurrentStyleSheet

Anonymous
Not applicable
1,653 Views
4 Replies
Message 1 of 5

Invalid Input when using SetCurrentStyleSheet

Anonymous
Not applicable

Hi,

 

I'm trying to get plotting to work.

I'm using the Model Space example and just adding the row

"acPlSetVdr.SetCurrentStyleSheet(acPlSet, "acad.ctb")"

I always end up with Invalid Input at that row.. I have tried to add the whole path to acad.ctb but it did not change anything..

Does anyone have any idea why this wont work?

 

Regards

Rikard

 

 

0 Likes
1,654 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

 

I found the solution myself.. It had something to do with the order in the code..

 

/Rikard 

0 Likes
Message 3 of 5

andy62
Contributor
Contributor

@Anonymous wrote:

 

I found the solution myself.. It had something to do with the order in the code..

 

/Rikard 



 

Hi Rikard 

I keep getting the error eInvalidInput, with the command SetCurrentStyleSheet
Can you please explain your solution?
thanks
andrea

0 Likes
Message 4 of 5

rikard.nilsson
Collaborator
Collaborator

Hi,

 

This was a long time ago.. I can't really figure out what I did.

But here is a code written in VB.NET that I know works..

Maybe that will help you to solve your problem if there is anyting when it comes to the order of rows...

 

/Rikard

 

 

'*****************************************

Dim layMgr As LayoutManager = LayoutManager.Current
Dim loObjId As ObjectId = layMgr.GetLayoutId(layMgr.CurrentLayout)
Dim lo As Layout = DirectCast(tr.GetObject(loObjId, OpenMode.ForRead), Layout)
Dim ps As New PlotSettings(lo.ModelType)
ps.CopyFrom(lo)
Dim pi As New PlotInfo()
pi.Layout = loObjId
Dim psv As PlotSettingsValidator = Autodesk.AutoCAD.DatabaseServices.PlotSettingsValidator.Current


MediaName = getInternalName(DeviceName, MediaName)

psv.SetPlotConfigurationName(ps, DeviceName, MediaName)
psv.RefreshLists(ps)
psv.SetPlotType(ps, Autodesk.AutoCAD.DatabaseServices.PlotType.Extents)
psv.SetUseStandardScale(ps, True)
psv.SetStdScaleType(ps, StdScaleType.ScaleToFit)

If ClickedPlotSize <> CurrentSheetSize Then
Dim msg As String
Dim title As String
Dim style As MsgBoxStyle
Dim response As MsgBoxResult
msg = "Do you want to use a CTB-file with thinner lines?" ' Define message.
style = MsgBoxStyle.YesNo
title = "Test" ' Define title.
' Display message.
response = MsgBox(msg, style, title)
If response = MsgBoxResult.Yes Then ' User chose Yes.
PlotStyleTable = GetVauleFromArray("CtbThinnerLinesName")
End If

End If

psv.SetCurrentStyleSheet(ps, PlotStyleTable)
psv.SetPlotRotation(ps, Plotrotation)

psv.SetPlotCentered(ps, True)

0 Likes
Message 5 of 5

andy62
Contributor
Contributor

@Anonymous wrote:

I found the solution by myself.

Before you change the currentstylesheet you must refresh the plotsettings

  

            acPlSetVdr.RefreshLists(acPlSet)  --> this works for me
            If acDerden = True Then
                acPlSetVdr.SetCurrentStyleSheet(acPlSet, "Dunne lijnen.ctb")
            Else
                acPlSetVdr.SetCurrentStyleSheet(acPlSet, "HP DesignJet 500.ctb")
            End If

 

Jacco


 

Thank you very much Rikard!

But, I found a Jacco's solution "RefreshLists", just now

 

Before you change the currentstylesheet you must refresh the plotsettings

  

            acPlSetVdr.RefreshLists(acPlSet)  --> this works for me
            If acDerden = True Then
                acPlSetVdr.SetCurrentStyleSheet(acPlSet, "Dunne lijnen.ctb")
            Else
                acPlSetVdr.SetCurrentStyleSheet(acPlSet, "HP DesignJet 500.ctb")
            End If

 

andy