SetClosestMediaName - why doesn't work?

SetClosestMediaName - why doesn't work?

Anonymous
Not applicable
1,158 Views
3 Replies
Message 1 of 4

SetClosestMediaName - why doesn't work?

Anonymous
Not applicable

Hello,

 

Has anyone got working exampe of SetClosestMediaName function?

I was trying everything and if I want to use this method, I'm always getting eInvalidInput.

 

Anyone knows why?

 

Thanks.

0 Likes
1,159 Views
3 Replies
Replies (3)
Message 2 of 4

norman.yuan
Mentor
Mentor

That method, according to the documentation in ObjectARX SDK (2012/13/14, that I downloaded), is not implemented.

 

I remembered in one of my drawing printing project, I also tried this method with very promising name in vain and only found out later it is not lmplemented in .NET API. Then I had to write my own code to find a closest printing media by looping through the available media sizes to compare them to the needed paper size.

 

HTH

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 4

fieldguy
Advisor
Advisor

I had the same problem and ended up with something like norman describes. This is what I used.

 

Dim medias As StringCollection = psv.GetCanonicalMediaNameList(ps)
                Dim mediafound As Boolean = False
                For j As Integer = 0 To medias.Count - 1
                    If psv.GetLocaleMediaName(ps, j) = "your page description" Then
                        psv.SetCanonicalMediaName(ps, medias.Item(j))
                        mediafound = True
                        Exit For
                    End If
                Next

 

 

 

0 Likes
Message 4 of 4

SENL1362
Advisor
Advisor
And if you are looking for ClosestMedia based on height and width, a compare based on area avoid a few if's
0 Likes