From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/97275 Path: news.gmane.org!.POSTED!not-for-mail From: William Adams Newsgroups: gmane.comp.tex.context Subject: Re: Creating SVG: using MetaFun, exporting proper units, conversion to DXF Date: Thu, 16 Feb 2017 15:07:42 -0500 Message-ID: References: <8d99c215-c4b8-e5cd-8784-e505bc406439@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3618598769789369840==" X-Trace: blaine.gmane.org 1487275748 16155 195.159.176.226 (16 Feb 2017 20:09:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 16 Feb 2017 20:09:08 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Feb 16 21:09:03 2017 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ceSMQ-0003o3-0S for gctc-ntg-context-518@m.gmane.org; Thu, 16 Feb 2017 21:09:02 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 4490E1202122; Thu, 16 Feb 2017 21:07:59 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U1Mns4iM66gM; Thu, 16 Feb 2017 21:07:58 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 1BA051202126; Thu, 16 Feb 2017 21:07:58 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id E60131202122 for ; Thu, 16 Feb 2017 21:07:56 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ARVil3bvavRD for ; Thu, 16 Feb 2017 21:07:55 +0100 (CET) Original-Received: from mail-it0-f42.google.com (mail-it0-f42.google.com [209.85.214.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id BF0781202117 for ; Thu, 16 Feb 2017 21:07:44 +0100 (CET) Original-Received: by mail-it0-f42.google.com with SMTP id x75so38232778itb.0 for ; Thu, 16 Feb 2017 12:07:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=frycomm-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=QReeGDtumf167kTYsz0n9DpNVI2s1IDTJ2gKLLQvheQ=; b=fdkVXAbyTSXv/wk74XJ+0cruaJlMzjBqfk7tK/TN2zKtbH1UFCkTA4omQ2+RpXOOx0 thSPibd/FZYEU355HyCro8IlsnpB/M+MR23wLKXl/yz5KwQ3sptZn2zgAzZhLCIOUFqM KzmrETRpVSHV1NIA+QAcjhEjBaDUfuyJN/vv6M8CdOapRc9HEg9GWDip5uBdLwfeNWxi HEZK+jfL5/oJFZ4qboMuv6VdgFd9Cd+Fx13iyRXvKrbWCpdOU3SCD2WOABdl6WU8JFN4 MY0FMuZVBo20n4JPoZK0oJni6LwpeqEOFl7JrSoSn4iAjn2E0OcKHeK0OJgg2MlEMIg5 iREQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=QReeGDtumf167kTYsz0n9DpNVI2s1IDTJ2gKLLQvheQ=; b=YYsMiQDLaQmjsIQ0JYdO/4Dbcn3DwZW19u8a0XkgtrPzrEiat4oMWlt16mV+6iFEu7 v0bOOsyhomcv/CPUJCZDA8C30EL5uSZivSUPtstgBnkMvkS/bsuo00iIKtorx17g7iU+ IYYVSxQMbqJ6Ym8RwKN52KnuN2AGHRlFKbHHrsg7PiCGxwUxIgVkWvw8ZKI7brMlGQK+ lFWC2PsDfoZJlYmjAJ5Fj6IHJNQW27dv7Juaox7uwVYldN8jp3qnd18COdhwr7dQsNLc UbUWeRUtXexUt6NMMQ2Wj74cUXd8rlKS152AwBBZahFrl3I07dcKvKE6G/Q0jOqQXLia XIGw== X-Gm-Message-State: AMke39kCZbzWqgi5+870HM57lV/HOd2qJqVcOQN9g7aM4bLqea+A0BZxhrptHN1SGc4XB6vvbVmS9f1lWnOSxA7V X-Received: by 10.107.170.157 with SMTP id g29mr4555449ioj.148.1487275663028; Thu, 16 Feb 2017 12:07:43 -0800 (PST) Original-Received: by 10.36.86.79 with HTTP; Thu, 16 Feb 2017 12:07:42 -0800 (PST) In-Reply-To: <8d99c215-c4b8-e5cd-8784-e505bc406439@wxs.nl> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:97275 Archived-At: --===============3618598769789369840== Content-Type: multipart/alternative; boundary=001a11426c84944ae00548ab59b8 --001a11426c84944ae00548ab59b8 Content-Type: text/plain; charset=UTF-8 Another option here would be to use a tool which directly accepts SVGs --- one free/opensource tool for that is PartKAM/MakerCAM. My apologies for the late response --- investigating this sort of thing myself, though I'll likely be using a proprietary tool, Carbide Create to drive either a Nomad or a Shapeoko. William On Thu, Jun 30, 2016 at 3:15 AM, Hans Hagen wrote: > On 6/29/2016 10:49 PM, Mojca Miklavec wrote: > >> On 29 June 2016 at 14:12, Hans Hagen wrote: >> >>> On 6/29/2016 12:31 PM, Mojca Miklavec wrote: >>> >>>> >>>> Hi, >>>> >>>> I want to play with CNC and don't yet have any experience with CAD >>>> software (nor the licence for the expensive ones) other than perhaps >>>> some Blender, so I decided to try to use the super ugly route with >>>> metapost -> svg -> dxf -> g-code >>>> for the first time. >>>> >>>> I have a few questions. >>>> >>>> (1) I love Hans' shortcuts in metafun, but I seem to remember that >>>> things >>>> like >>>> input metafun; >>>> or perhaps >>>> input mp-tool; >>>> used to work, so that I don't have to remember to use >>>> mpost -mem=metafun my-drawings.mp >>>> when compiling the graphics. >>>> >>>> Did the method with "input" ever work (or is it supposed to work)? Now >>>> I'm getting a bunch of weird errors. >>>> I would love to specify everything in the source file and then just >>>> call mpost. If that doesn't work, that's fine, I can still add >>>> "-mem=metafun", but ... >>>> >>> >>> >>> input metafun.mpiv ; >>> >> >> How should one properly compile that file then to get the SVG? >> > > some mp directive (but i never tried) as i always just use \startMPpage .. > \stopMPpage so that fonts etc work ok too > > Using just "mpost something.mp" doesn't work that way. >> >> (2) I guess that using "raw metapost" is the only sane way to generate >>>> SVG. If I use metapost inside ConTeXt that's probably not going to >>>> work, right? >>>> >>>> (3) Is there any way to convince the SVG output mode to generate >>>> something >>>> like >>>> >>>> rather than >>>> >>> > >>>> because the program I use to convert SVG to DXF has troubles >>>> interpreting "points" properly. I read somewhere that they assume 90 >>>> points per inch because that's Inkskape's default. >>>> >>> >>> why not just >>> >>> \startMPpage >>> whatever you want >>> \stopMPpage >>> >>> and then use mudraw (mutools) to go from pdf to svg (that's what i do >>> when i >>> need svg) >>> >> >> Given that metapost supports SVG natively I imagined that it would >> produce a simpler/cleaner output. Thanks a lot for the suggestion, >> I'll test it. >> > > the svg from pdf is normally quite simple as it just output the same > paths, colors etc + text as outline > > It turned out that the (opensource) tools I used for converting SVG >> into DXF gives very weird result, so I have to change the other parts >> of the "toolchain" as well. >> >> Nevertheless, the question about whether one could convince MP to >> output true units in cm/mm/in.-- >> > > no, but you can of course scale the whole lot just before shipping so that > units represent cm > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | 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/list > info/ntg-context > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > ____________________________________________________________ > _______________________ > --001a11426c84944ae00548ab59b8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Another option here would be to use a tool which dire= ctly accepts SVGs --- one free/opensource tool for that is PartKAM/MakerCAM= .

My apologies for the late response --- investiga= ting this sort of thing myself, though I'll likely be using a proprieta= ry tool, Carbide Create to drive either a Nomad or a Shapeoko.
William

On Thu, Jun 30, 2016 at 3:15 AM, Hans Hagen <pragma@wxs.nl> wrote:
some mp directive (but i never tried) as i always just use \startMPpage .. = \stopMPpage so that fonts etc work ok too

Using just "mpost something.mp" doesn't work that way.

(2) I guess that using "raw metapost" is the only sane way to gen= erate
SVG. If I use metapost inside ConTeXt that's probably not going to
work, right?

(3) Is there any way to convince the SVG output mode to generate something<= br> like
=C2=A0 =C2=A0 <svg ... width=3D"100.0mm" height=3D"100.0m= m" ... >
rather than
=C2=A0 =C2=A0 <svg ... width=3D"283.46456692913387" height=3D&= quot;283.46456692913387" ... >
because the program I use to convert SVG to DXF has troubles
interpreting "points" properly. I read somewhere that they assume= 90
points per inch because that's Inkskape's default.

why not just

\startMPpage
=C2=A0 whatever you want
\stopMPpage

and then use mudraw (mutools) to go from pdf to svg (that's what i do w= hen i
need svg)

Given that metapost supports SVG natively I imagined that it would
produce a simpler/cleaner output. Thanks a lot for the suggestion,
I'll test it.

the svg from pdf is normally quite simple as it just output the same paths,= colors etc + text as outline

It turned out that the (opensource) tools I used for converting SVG
into DXF gives very weird result, so I have to change the other parts
of the "toolchain" as well.

Nevertheless, the question about whether one could convince MP to
output true units in cm/mm/in.--

no, but you can of course scale the whole lot just before shipping so that = units represent cm

-----------------------------------------------------------------=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 H= ans Hagen | PRAGMA ADE
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Ridderstraat 27 | 8061 GH = Hasselt | The Netherlands
=C2=A0 =C2=A0 =C2=A0 tel: 038 477 53 69 | www.pragma-ade.com | www.prag= ma-pod.nl
-----------------------------------------------------------------=
_________________________________________________________________= __________________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / http://www.ntg.nl/mailman/listin= fo/ntg-context
webpage=C2=A0 : http://www.pragma-ade.nl / http://tex.aanhet.net
archive=C2=A0 : http://foundry.supelec.fr/project= s/contextrev/
wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
_________________________________________________________________= __________________

--001a11426c84944ae00548ab59b8-- --===============3618598769789369840== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f --===============3618598769789369840==--