Re: [NTG-context] 3D annotations problems
Dear Hans and All, On Sat, Aug 18, 2012 at 10:00 PM, Michail Vidiassov mas...@iaas.msu.ru wrote: the examples from back-u3d.mkiv fail to work with latest beta (rectangled undefined message appears instead of annotation), but if \textwidth is replaced by in in the tex file 3D annotations appear OK. in the latest minimals (2012.09.06 23:03) the following example from back-u3d.mkiv fails to work \useexternalfigure [test] [test.prc] [width=0.5\textwidth, height=0.5\textwidth, display=u3d:myset:display:1, controls=u3d:myset:controls:1] \placefigure[here]{3d test}{\externalfigure[test]} while after getting rid of \texwidth the following does: \useexternalfigure [test] [test.prc] [width=3in, height=3in, display=u3d:myset:display:1, controls=u3d:myset:controls:1] \placefigure[here]{3d test}{\externalfigure[test]} Is it a bug of the example got wrong with some changes in ConTeXt. Sincerely, Michail ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] 3D annotations problems
Am 09.09.2012 um 11:00 schrieb Michail Vidiassov mas...@iaas.msu.ru: Dear Hans and All, On Sat, Aug 18, 2012 at 10:00 PM, Michail Vidiassov mas...@iaas.msu.ru wrote: the examples from back-u3d.mkiv fail to work with latest beta (rectangled undefined message appears instead of annotation), but if \textwidth is replaced by in in the tex file 3D annotations appear OK. in the latest minimals (2012.09.06 23:03) the following example from back-u3d.mkiv fails to work \useexternalfigure [test] [test.prc] [width=0.5\textwidth, height=0.5\textwidth, display=u3d:myset:display:1, controls=u3d:myset:controls:1] \placefigure[here]{3d test}{\externalfigure[test]} while after getting rid of \texwidth the following does: \useexternalfigure [test] [test.prc] [width=3in, height=3in, display=u3d:myset:display:1, controls=u3d:myset:controls:1] \placefigure[here]{3d test}{\externalfigure[test]} Is it a bug of the example got wrong with some changes in ConTeXt. It should work when you use “width=\the\dimexpr\textwidth/2\relax” or “width=\the\dimexpr0.5\textwidth\relax”. Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] 3D annotations problems
Dear Wolfgang and All, On Sun, Sep 9, 2012 at 4:52 PM, Wolfgang Schuster wolfgang.schus...@gmail.com wrote: in the latest minimals (2012.09.06 23:03) the following example from back-u3d.mkiv fails to work \useexternalfigure [test] [test.prc] [width=0.5\textwidth, ... It should work when you use “width=\the\dimexpr\textwidth/2\relax” or “width=\the\dimexpr0.5\textwidth\relax”. thank you, that works. Is it a permanent change of rules or the old shorter way is just temporary disabled by some ongoing unfinished development of ConTeXt code? Sincerely, Michail ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] 3D annotations problems
Just a follow up - the old way width=0.5\textwidth still works for png external figures. Is it considered non-kosher now and is to be changed everywhere to the new one “width=\the\dimexpr0.5\textwidth\relax” whenever possible to avoid potential problems? ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] 3D annotations problems
Am 09.09.2012 um 16:07 schrieb Michail Vidiassov mas...@iaas.msu.ru: Just a follow up - the old way width=0.5\textwidth still works for png external figures. When you use images in jpg, png or pdf format context still uses a lot of tex code where you can use this form of assignment because the values are assigned to another dimen register in tex where this is valid. \starttext \newdimen\mydimenregister \mydimenregister=10pt mydimenregister = \the\mydimenregister \mydimenregister=\textwidth mydimenregister = \the\mydimenregister \mydimenregister=.33\textwidth mydimenregister = \the\mydimenregister \stoptext When you insert a 3D graphic in your document the values of the width/height keys are read by lua which can’t handle with this assignment, what can be used in this case are only absolute values like 10pt and with \the\dimepr… you can do this even with relative value, e.g. .5\textwidth. Is it considered non-kosher now and is to be changed everywhere to the new one “width=\the\dimexpr0.5\textwidth\relax” whenever possible to avoid potential problems? Maybe Hans can add some code which checks the argument to avoid this, e.g. if argument == fit or argument == broad then return argument else return \the\dimeprargument\relax fi Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] 3D annotations
On Sun, 2 May 2010, gummybears wrote: I read your email (17 april 2010) on the mailing list and applied the two patches to my Context minimal distro (the very latest version). When I run your test.tex through context the preview image test.png is not shown. did you recreate formats after patch (context -make if memory serves me right)? I will test with current minimals today. Probably not (my mistake), but now I did make the formats and with the current minimals I got the following error (when running your test.tex file) bodyfont: 12pt rm is loaded language: language en is active systems : begin file test.tex at line 3 floatblocks : 1 placed ! LuaTeX error ...text/tex/texmf-context/tex/context/base/lpdf-mis.lua:163: attempt to call field 'timestamp' (a nil value) stack traceback: ...text/tex/texmf-context/tex/context/base/lpdf-mis.lua:163: in function 'setupidentity' main ctx instance:1: in main chunk. \synchronizebackendidentity ...akeyword \!!es , }} \actualshipout ...lio \or \the \everyfirstshipout \global \everyfirstshipout... \myshipout ...\@@ppmethod }\gobbleoneargument {#1} \setnextrealpageno \afters... \dofinaloutput ...hbox {\vbox {\dopagebody #1#2}}} \the \everyaftershipout \a... \finaloutput ...EAEAEA \dofinaloutput \fi \fi #1#2 \resetselectiepagina \incr... \sidefloatoutput ...e \else \finalsidefloatoutput \global \sidefloatvsize \n... ... l.23 \stopTEXpage ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] 3D annotations
Dear gummybears, On Tue, 4 May 2010, gummybears wrote: I read your email (17 april 2010) on the mailing list and applied the two patches to my Context minimal distro (the very latest version). When I run your test.tex through context the preview image test.png is not shown. did you recreate formats after patch Probably not (my mistake), but now I did make the formats and with the current minimals I got the following error (when running your test.tex file) bodyfont : 12pt rm is loaded language : language en is active systems : begin file test.tex at line 3 floatblocks : 1 placed ! LuaTeX error ...text/tex/texmf-context/tex/context/base/lpdf-mis.lua:163: attempt to call field 'timestamp' (a nil value) stack traceback: ...text/tex/texmf-context/tex/context/base/lpdf-mis.lua:163: in function 'setupidentity' main ctx instance:1: in main chunk. \synchronizebackendidentity ...akeyword \!!es , }} \actualshipout ...lio \or \the \everyfirstshipout \global \everyfirstshipout... \myshipout ...\@@ppmethod }\gobbleoneargument {#1} \setnextrealpageno \afters... \dofinaloutput ...hbox {\vbox {\dopagebody #1#2}}} \the \everyaftershipout \a... \finaloutput ...EAEAEA \dofinaloutput \fi \fi #1#2 \resetselectiepagina \incr... \sidefloatoutput ...e \else \finalsidefloatoutput \global \sidefloatvsize \n... ... l.23 \stopTEXpage Which version of ConText should I use to make it work? I have just downloaded the latest version (2010.04.29 22:30) to my Mac OS X 10.6.3, patched, run test.tex and got no problem. May be you can describe our setup in more detail (context version, OS, 32/64 bit). Sincerely, michail ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] 3D annotations
Hi Michail, I read your email (17 april 2010) on the mailing list and applied the two patches to my Context minimal distro (the very latest version). When I run your test.tex through context the preview image test.png is not shown. Which version of ConText should I use to make it work Thanks in advance ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] 3D annotations
Dear Hans, I wrote to you thank you for your latest effort to put u3d support in a working state, but more thanks for more effort, but May be a more robust way is to read first 3 bytes of the model file, since U3D or PRC signature is always there - that can be done instead of relying on file name extension or only in case it it not u3d or prc. you have implemented reading the file signature, but it is now almost useless, since if a file has extension other but U3D or PRC 3D annotation code will not be called by file inclusion mechanism and io.readdata routine is called local subtype, subdata = U3D, io.readdata(foundname) or - what's that? One more point - preview bitmap images in 3D annotations are now disabled since necessary functionality of measuring XForms is missing - please, consider the following workaround. --- lpdf-u3d.lua.org2010-03-26 18:24:44.0 +0300 +++ lpdf-u3d.lua2010-04-14 14:24:28.0 +0400 @@ -17,6 +17,7 @@ local cos, sin, sqrt, pi, atan2, abs = math.cos, math.sin, math.sqrt, math.pi, math.atan2, math.abs local pdfconstant = lpdf.constant +local pdfnumber = lpdf.number local pdfboolean= lpdf.boolean local pdfunicode= lpdf.unicode local pdfdictionary = lpdf.dictionary @@ -62,8 +63,7 @@ local function make3dview(view) -local name = viewname -local name = pdfunicode((view.name ~= and name) or unknown view) +local name = pdfunicode((view.name ~= and view.name) or unknown view) local viewdict = pdfdictionary { Type = pdfconstant(3DView), @@ -311,9 +311,6 @@ for i=1,#nodes do local node = checkedkey(nodes,i,table) if node then -local position = checkedkey(node,position,table) -position = position and #position == 12 and pdfarray(position) -if position then nodelist[#nodelist+1] = pdfdictionary { Type = pdfconstant(3DNode), N= node.name or (node_ .. i), -- pdfunicode ? @@ -325,13 +322,18 @@ }, M= position, } +local position = checkedkey(node,position,table) +position = position and #position == 12 and pdfarray(position) +if position then +nodelist[#nodelist].M = position end end end - viewdict.NR = true viewdict.NA = nodelist end +viewdict.NR = true + return viewdict end @@ -349,19 +351,19 @@ local activationdict = pdfdictionary { TB = pdfboolean(param.toolbar,true), - NP = pdfboolean(param.tree,true), + NP = pdfboolean(param.tree,false), } local stream = streams[label] if not stream then -local subtype, subdata = U3D, io.readdata(foundname) or +local subtype, subdata = U3D, file.readdata(foundname) or if find(subdata,^PRC) then -subtype == PRC +subtype = PRC elseif find(subdata,^U3D) then -subtype == U3D +subtype = U3D elseif file.extname(foundname) == prc then -subtype == PRC +subtype = PRC end local attr = pdfdictionary { @@ -423,12 +425,35 @@ local ref = stored_pr[tag] if not ref then -- weird, has to be a /Form and not an /Image so we need a wrap = true key --- local figure = img.immediatewrite { filename = preview, width = width, height = height } -local figure = img.immediatewrite { stream = .5 .75 .75 rg 0 0 20 10 re f, bbox = {0,0,20,10 } } +local figure = img.immediatewrite { filename = preview, width = width, height = height } +-- local figure = img.immediatewrite { stream = .5 .75 .75 rg 0 0 20 10 re f, bbox = {0,0,20,10 } } ref = figure.objnum stored_pr[tag] = ref end -annot.AP = ref and pdfdictionary { N = pdfreference(ref) } +if ref then +local pw = pdfdictionary { +Type = pdfconstant(XObject), +Subtype = pdfconstant(Form), +FormType = pdfnumber(1), +BBox = pdfarray { pdfnumber(0), pdfnumber(0), pdfnumber(factor*width), pdfnumber(factor*height) }, +Matrix= pdfarray { pdfnumber(1), pdfnumber(0), pdfnumber(0), pdfnumber(1), pdfnumber(0), pdfnumber(0) }, +Resources = pdfdictionary { +XObject = pdfdictionary { +IM = pdfreference(ref) +} +}, +ExtGState = pdfdictionary { +GS = pdfdictionary { +Type = pdfconstant(ExtGState), +CA = pdfnumber(1), +
Re: [NTG-context] 3D annotations
On 26-3-2010 6:53, Michail Vidiassov wrote: lpdf-u3d.lua if not stream then local attr = pdfdictionary { Type = pdfconstant(3D), - Subtype = pdfconstant(U3D), } + if string.upper(string.sub(foundname,-4))==.PRC then + attr.Subtype = pdfconstant(PRC) + else + attr.Subtype = pdfconstant(U3D) + end local streamviews = checkedkey(streamparam, views, table) if streamviews then local list = pdfarray() May be a more robust way is to read first 3 bytes of the model file, since U3D or PRC signature is always there - that can be done instead of relying on file name extension or only in case it it not u3d or prc. more like: local subtype, subdata = U3D, io.readdata(foundname) or if find(subdata,^PRC) then subtype == PRC elseif find(subdata,^U3D) then subtype == U3D elseif file.extname(foundname) == prc then subtype == PRC end Also PRC annotations have to trigger setting PDF version to 1.7.3 (developer extensions dictionary mechanism). It can be done per your advice directly \doPDFaddtocatalog { /Extensions /ADBE /BaseVersion /1.7 /ExtensionLevel 3 } But what about an interface like \pdfmicroversion and automatic pushing up of PDF version once PRC annontation happens? i don't know that command and anyway want to get rid of all commands that start with \pdf concerning versions ... peter rolf and i are working on detailed support for standards (also related to preflighting) and before i even want to look in some automated version handling we first need to get that bit done well Also I try to remind you about pdfboolean problem in lpdf-ini.lua (old code is not OK if b is false and default is true) local function pdfboolean(b,default) - if ((type(b) == boolean) and b) or default then - return p_true + if type(b) ~= boolean then + if default then + return p_true + else + return p_false + end else - return p_false + if b then + return p_true + else + return p_false + end end end i need to check it ... later (also for interferences) PS. And a great palliative way to deal with 3D annotations is via attaching a 3D PDF file made with LaTeX (by Asymptote, for example). well, one can attach files as-is already (unless it's broken) I can not deduce from existing sea of ConTeXt code the status of file attachments support. \attachment has been there for ages actually, all kind of annotations hav ebeen supported as soon as they showed up in acrobat (mediademo is an exmaple of flash) but i gave up on implementing these things too early as in acrobat/pdf such new tricks normally needs a few versions to reach stability Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] 3D annotations - was: status of node.write
On 25-3-2010 20:12, Michail Vidiassov wrote: to at least make code run without throwing error messages. new beta Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] 3D annotations
Dear Hans, On Thu, 25 Mar 2010, Michail Vidiassov wrote: On Wed, 24 Mar 2010, Hans Hagen wrote: there is u3d support presen tbut nobody tested it thank you for your latest effort to put u3d support in a working state, but now that Adobe has fallen in love with a new 3D format, PRC, the following is to be changed: lpdf-u3d.lua if not stream then local attr = pdfdictionary { Type= pdfconstant(3D), -Subtype = pdfconstant(U3D), } +if string.upper(string.sub(foundname,-4))==.PRC then +attr.Subtype = pdfconstant(PRC) +else +attr.Subtype = pdfconstant(U3D) +end local streamviews = checkedkey(streamparam, views, table) if streamviews then local list = pdfarray() May be a more robust way is to read first 3 bytes of the model file, since U3D or PRC signature is always there - that can be done instead of relying on file name extension or only in case it it not u3d or prc. Also PRC annotations have to trigger setting PDF version to 1.7.3 (developer extensions dictionary mechanism). It can be done per your advice directly \doPDFaddtocatalog { /Extensions /ADBE /BaseVersion /1.7 /ExtensionLevel 3 } But what about an interface like \pdfmicroversion and automatic pushing up of PDF version once PRC annontation happens? Also I try to remind you about pdfboolean problem in lpdf-ini.lua (old code is not OK if b is false and default is true) local function pdfboolean(b,default) -if ((type(b) == boolean) and b) or default then -return p_true +if type(b) ~= boolean then +if default then +return p_true +else +return p_false +end else -return p_false +if b then +return p_true +else +return p_false +end end end Sincerely, Michail PS. And a great palliative way to deal with 3D annotations is via attaching a 3D PDF file made with LaTeX (by Asymptote, for example). But while your method of answering my messages in lua works OK for new code (updating minimals and making a diff with old code is not harder than checking e-mail inbox - Your morning patch, sir! ;), I can not deduce from existing sea of ConTeXt code the status of file attachments support. ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___