Skip to content

2D svg not importing at correct scale into Inkscape 0.48 #83

chuck-h opened this Issue Dec 14, 2012 · 6 comments

3 participants

colah commented Dec 22, 2012

@chuck-h: This should be fixed now. Can you verify that it is?

chuck-h commented Dec 24, 2012

I haven't been able to test this yet.

I found I needed to jump through a few hoops, then ultimately the compile failed. Probably my bad, I am not up to speed on the Haskell build environment.

>cabal configure
Resolving dependencies...
Configuring implicit-0.0.2...
cabal: At least the following dependencies are missing:
optparse-applicative -any

C:\Documents and Settings\Chuck\My Documents\GeekProjects\OSE\ImpCad\ImplicitCAD
>cabal install optparse-applicative
Resolving dependencies...
Downloading optparse-applicative-0.5.2...
Configuring optparse-applicative-0.5.2...
Building optparse-applicative-0.5.2...
Preprocessing library optparse-applicative-0.5.2...

OK, then

C:\Documents and Settings\Chuck\My Documents\GeekProjects\OSE\ImpCad\ImplicitCAD>cabal configure
Resolving dependencies...
Configuring implicit-0.0.2...

C:\Documents and Settings\Chuck\My Documents\GeekProjects\OSE\ImpCad\ImplicitCAD>cabal install
Resolving dependencies...
In order, the following will be installed:
implicit-0.0.2 (reinstall) changes: optparse-applicative-0.5.2 added
Warning: Note that reinstalls are always dangerous. Continuing anyway...
Configuring implicit-0.0.2...
Building implicit-0.0.2...
Preprocessing library implicit-0.0.2...

OK, then

Registering implicit-0.0.2...
Preprocessing executable 'extopenscad' for implicit-0.0.2...

OK, then my problem point:

[32 of 45] Compiling Graphics.Implicit.ExtOpenScad.Definitions ( Graphics\Implic
it\ExtOpenScad\Definitions.hs, dist\build\extopenscad\extopenscad-tmp\Graphics\I
mplicit\ExtOpenScad\Definitions.o )

    Overlapping instances for Show (OVal -> ArgParser a)
      arising from the 'deriving' clause of a data type declaration
    Matching instances:
      instance Show (a -> b)
        -- Defined in `NumInstances-1.0:Data.NumInstances'
      instance Show (a -> b)
        -- Defined at Graphics\Implicit\Definitions.hs:162:10
    When deriving the instance for (Show (ArgParser a))
cabal: Error: some packages failed to install:
implicit-0.0.2 failed during the building phase. The exception was:
ExitFailure 1
chuck-h commented Dec 25, 2012

Still struggling with this build.

I did ghc-pkg unregister implicit-0.0.2 then another cabal install (is that what I am supposed to do after pulling down a git update?) and now I have a different failure.

[45 of 45] Compiling Main             ( extopenscad.hs, dist\build\extopenscad\extopenscad-tmp\Main.o )

    Couldn't match expected type `Either
                                    Options.Applicative.ParseError (Maybe FilePath)'
                with actual type `Maybe b0'
    Expected type: b0
                   -> Either Options.Applicative.ParseError (Maybe FilePath)
      Actual type: b0 -> Maybe b0
    In the first argument of `(.)', namely `Just'
    In the first argument of `reader', namely `(Just . str)'
cabal: Error: some packages failed to install:
implicit-0.0.2 failed during the building phase. The exception was:
ExitFailure 1

C:\Documents and Settings\Chuck\My Documents\GeekProjects\OSE\ImpCad\ImplicitCAD
>ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.4.2
chuck-h commented Dec 25, 2012

I rolled back to before the merge of pull request #90 and successfully compiled. The viewBox coordinates were in the wrong order, here is the patch to Graphics/Implicit/Export/PolylineFormats.hs:

@@ -25,11 +25,11 @@ svg plines = renderSvg . svg11 . svg' $ plines
            where (xs,ys) = unzip (concat plines)

       svg11 content = docTypeSvg ! A.version "1.1" 
                                  ! A.width  (stringValue $ show (xmax-xmin) ++ "mm")
                                  ! A.height (stringValue $ show (ymax-ymin) ++ "mm")
-                                 ! A.viewbox (stringValue $ concat . intersperse " " . map show $ [xmin, xmax, ymin, ymax])
+                                 ! A.viewbox (stringValue $ concat . intersperse " " . map show $ [xmin, ymin, xmax, ymax])
                                  $ content
       -- The reason this isn't totally straightforwards is that svg has different coordinate system
       -- and we need to compute the requisite translation.

I have fixed this in a recent pull request. I will probably be closing this issue unless you verify that there is still a problem for you. But it's been three years since your last comment, so maybe you're gone. :)


Without further comment I'll assume this issue is fixed.

@mmachenry mmachenry closed this Sep 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.