How to write mirrored text with 'ezdxf'?How to merge two dictionaries in a single expression?How do I check if a list is empty?How do I check whether a file exists without exceptions?How can I safely create a nested directory?How to get the current time in PythonHow can I make a time delay in Python?How do I sort a dictionary by value?How to make a chain of function decorators?How to make a flat list out of list of listsHow do I list all files of a directory?

Minimum population for language survival

What should we do with manuals from the 80s?

Is this bar slide trick shown on Cheers real or a visual effect?

What's the relationship betweeen MS-DOS and XENIX?

How does the Moon's gravity affect Earth's oceans despite Earth's stronger gravitational pull?

Why should I pay for an SSL certificate?

Why is the battery jumpered to a resistor in this schematic?

Is there a fallacy about "appeal to 'big words'"?

Setting up a Mathematical Institute of Refereeing?

Has the speed of light ever been measured in vacuum?

What does 〇〇〇〇 mean when combined with おじさん?

Visa on arrival to exit airport in Russia

The space of cusp forms for GL_2 over F_q(T)

Eric Andre had a dream

Unconventional examples of mathematical modelling

What allows us to use imaginary numbers?

What if a restaurant suddenly cannot accept credit cards, and the customer has no cash?

What's a good pattern to calculate a variable only when it is used the first time?

Why does "auf der Strecke bleiben" mean "to fall by the wayside"?

Adding things to bunches of things vs multiplication

Why do so many people play out of turn on the last lead?

Will Force.com stop working on salesforce Lightning?

What is the fastest way to level past 95 in Diablo II?

Is there a way, other than having a Diviner friend, for a player to avoid rolling Initiative at the start of a combat?



How to write mirrored text with 'ezdxf'?


How to merge two dictionaries in a single expression?How do I check if a list is empty?How do I check whether a file exists without exceptions?How can I safely create a nested directory?How to get the current time in PythonHow can I make a time delay in Python?How do I sort a dictionary by value?How to make a chain of function decorators?How to make a flat list out of list of listsHow do I list all files of a directory?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I need to write text in DXF drawing mirrored. I use python and ezdxf module. According to docs there are some flags to be set but I always get DXFAttributeError.



I try to use 'text_generation_flags': 2 and 'text_direction': (-1, 0, 0)



here is my code (works well without mirroring attempst)




def publish_face_no_bolts(poly, label, filename):

t = poly.get_default_transformation()
trans_poly = poly.transform(t)
# trans_poly = trans_poly.make_coordinates_positive()
points = transformation.points_3d_to_2d(trans_poly.poly_points)
points.append(points[0]) # must close polygon

drawing = ezdxf.new(dxfversion='AC1024') # or use the AutoCAD release name ezdxf.new(dxfversion='R2010')
modelspace = drawing.modelspace()

modelspace.add_lwpolyline(points, dxfattribs='color': 7)

drawing.layers.new('TEXTLAYER', dxfattribs='color': 1)

# use set_pos() for proper TEXT alignment - the relations between halign, valign, insert and align_point are tricky.


# drawing.styles.new('mirrored', dxfattribs='text_generation_flags': 2)
# 'text_direction': (0, 1, 0), # write in y direction
drawing.styles.new('mirrored', dxfattribs= 'text_direction': (-1, 0, 0))

err, cx, cy = polygon.centroid2d(points)

modelspace.add_text(label, dxfattribs='layer': 'TEXTLAYER', 'text_direction': (-1, 0, 0), 'height': 4).set_pos((cx, cy), align='CENTER')
drawing.saveas(filename)



Which flag to use and how to set it in a proper way?










share|improve this question






























    1















    I need to write text in DXF drawing mirrored. I use python and ezdxf module. According to docs there are some flags to be set but I always get DXFAttributeError.



    I try to use 'text_generation_flags': 2 and 'text_direction': (-1, 0, 0)



    here is my code (works well without mirroring attempst)




    def publish_face_no_bolts(poly, label, filename):

    t = poly.get_default_transformation()
    trans_poly = poly.transform(t)
    # trans_poly = trans_poly.make_coordinates_positive()
    points = transformation.points_3d_to_2d(trans_poly.poly_points)
    points.append(points[0]) # must close polygon

    drawing = ezdxf.new(dxfversion='AC1024') # or use the AutoCAD release name ezdxf.new(dxfversion='R2010')
    modelspace = drawing.modelspace()

    modelspace.add_lwpolyline(points, dxfattribs='color': 7)

    drawing.layers.new('TEXTLAYER', dxfattribs='color': 1)

    # use set_pos() for proper TEXT alignment - the relations between halign, valign, insert and align_point are tricky.


    # drawing.styles.new('mirrored', dxfattribs='text_generation_flags': 2)
    # 'text_direction': (0, 1, 0), # write in y direction
    drawing.styles.new('mirrored', dxfattribs= 'text_direction': (-1, 0, 0))

    err, cx, cy = polygon.centroid2d(points)

    modelspace.add_text(label, dxfattribs='layer': 'TEXTLAYER', 'text_direction': (-1, 0, 0), 'height': 4).set_pos((cx, cy), align='CENTER')
    drawing.saveas(filename)



    Which flag to use and how to set it in a proper way?










    share|improve this question


























      1












      1








      1








      I need to write text in DXF drawing mirrored. I use python and ezdxf module. According to docs there are some flags to be set but I always get DXFAttributeError.



      I try to use 'text_generation_flags': 2 and 'text_direction': (-1, 0, 0)



      here is my code (works well without mirroring attempst)




      def publish_face_no_bolts(poly, label, filename):

      t = poly.get_default_transformation()
      trans_poly = poly.transform(t)
      # trans_poly = trans_poly.make_coordinates_positive()
      points = transformation.points_3d_to_2d(trans_poly.poly_points)
      points.append(points[0]) # must close polygon

      drawing = ezdxf.new(dxfversion='AC1024') # or use the AutoCAD release name ezdxf.new(dxfversion='R2010')
      modelspace = drawing.modelspace()

      modelspace.add_lwpolyline(points, dxfattribs='color': 7)

      drawing.layers.new('TEXTLAYER', dxfattribs='color': 1)

      # use set_pos() for proper TEXT alignment - the relations between halign, valign, insert and align_point are tricky.


      # drawing.styles.new('mirrored', dxfattribs='text_generation_flags': 2)
      # 'text_direction': (0, 1, 0), # write in y direction
      drawing.styles.new('mirrored', dxfattribs= 'text_direction': (-1, 0, 0))

      err, cx, cy = polygon.centroid2d(points)

      modelspace.add_text(label, dxfattribs='layer': 'TEXTLAYER', 'text_direction': (-1, 0, 0), 'height': 4).set_pos((cx, cy), align='CENTER')
      drawing.saveas(filename)



      Which flag to use and how to set it in a proper way?










      share|improve this question














      I need to write text in DXF drawing mirrored. I use python and ezdxf module. According to docs there are some flags to be set but I always get DXFAttributeError.



      I try to use 'text_generation_flags': 2 and 'text_direction': (-1, 0, 0)



      here is my code (works well without mirroring attempst)




      def publish_face_no_bolts(poly, label, filename):

      t = poly.get_default_transformation()
      trans_poly = poly.transform(t)
      # trans_poly = trans_poly.make_coordinates_positive()
      points = transformation.points_3d_to_2d(trans_poly.poly_points)
      points.append(points[0]) # must close polygon

      drawing = ezdxf.new(dxfversion='AC1024') # or use the AutoCAD release name ezdxf.new(dxfversion='R2010')
      modelspace = drawing.modelspace()

      modelspace.add_lwpolyline(points, dxfattribs='color': 7)

      drawing.layers.new('TEXTLAYER', dxfattribs='color': 1)

      # use set_pos() for proper TEXT alignment - the relations between halign, valign, insert and align_point are tricky.


      # drawing.styles.new('mirrored', dxfattribs='text_generation_flags': 2)
      # 'text_direction': (0, 1, 0), # write in y direction
      drawing.styles.new('mirrored', dxfattribs= 'text_direction': (-1, 0, 0))

      err, cx, cy = polygon.centroid2d(points)

      modelspace.add_text(label, dxfattribs='layer': 'TEXTLAYER', 'text_direction': (-1, 0, 0), 'height': 4).set_pos((cx, cy), align='CENTER')
      drawing.saveas(filename)



      Which flag to use and how to set it in a proper way?







      python dxf






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 27 at 12:32









      xapoxapo

      83 bronze badges




      83 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          0














          I've not used ezdxf, but text_direction is a property of an MTEXT entity (DXF group 11), and is another way to effectively control the rotation of the MText.



          To mirror a single-line TEXT entity, you'll want to set DXF group 71 to 2, which, after briefly looking over the code for ezdxf, looks to be implemented as as the text_generation_flag parameter.



          Hence, I would suggest:



          modelspace.add_text(label, dxfattribs='layer': 'TEXTLAYER', 'text_generation_flag': 2, 'height': 4).set_pos((cx, cy), align='CENTER')





          share|improve this answer


























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55377283%2fhow-to-write-mirrored-text-with-ezdxf%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I've not used ezdxf, but text_direction is a property of an MTEXT entity (DXF group 11), and is another way to effectively control the rotation of the MText.



            To mirror a single-line TEXT entity, you'll want to set DXF group 71 to 2, which, after briefly looking over the code for ezdxf, looks to be implemented as as the text_generation_flag parameter.



            Hence, I would suggest:



            modelspace.add_text(label, dxfattribs='layer': 'TEXTLAYER', 'text_generation_flag': 2, 'height': 4).set_pos((cx, cy), align='CENTER')





            share|improve this answer































              0














              I've not used ezdxf, but text_direction is a property of an MTEXT entity (DXF group 11), and is another way to effectively control the rotation of the MText.



              To mirror a single-line TEXT entity, you'll want to set DXF group 71 to 2, which, after briefly looking over the code for ezdxf, looks to be implemented as as the text_generation_flag parameter.



              Hence, I would suggest:



              modelspace.add_text(label, dxfattribs='layer': 'TEXTLAYER', 'text_generation_flag': 2, 'height': 4).set_pos((cx, cy), align='CENTER')





              share|improve this answer





























                0












                0








                0







                I've not used ezdxf, but text_direction is a property of an MTEXT entity (DXF group 11), and is another way to effectively control the rotation of the MText.



                To mirror a single-line TEXT entity, you'll want to set DXF group 71 to 2, which, after briefly looking over the code for ezdxf, looks to be implemented as as the text_generation_flag parameter.



                Hence, I would suggest:



                modelspace.add_text(label, dxfattribs='layer': 'TEXTLAYER', 'text_generation_flag': 2, 'height': 4).set_pos((cx, cy), align='CENTER')





                share|improve this answer















                I've not used ezdxf, but text_direction is a property of an MTEXT entity (DXF group 11), and is another way to effectively control the rotation of the MText.



                To mirror a single-line TEXT entity, you'll want to set DXF group 71 to 2, which, after briefly looking over the code for ezdxf, looks to be implemented as as the text_generation_flag parameter.



                Hence, I would suggest:



                modelspace.add_text(label, dxfattribs='layer': 'TEXTLAYER', 'text_generation_flag': 2, 'height': 4).set_pos((cx, cy), align='CENTER')






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 27 at 23:23

























                answered Mar 27 at 23:16









                Lee MacLee Mac

                8,8626 gold badges17 silver badges52 bronze badges




                8,8626 gold badges17 silver badges52 bronze badges





















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55377283%2fhow-to-write-mirrored-text-with-ezdxf%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript