AutoCAD Map 3D General Discussion

Posts: 4
Registered: ‎06-05-2013
Message 1 of 6 (393 Views)

Export MTEXT alignment (justification) to SHP or SDF

393 Views, 5 Replies
11-26-2013 12:32 PM

Hello guys,


Is it possible to export MTEXT alignment (top left, middle center, etc) to a GIS format such as SDF or SHP? I'm able to export MTEXT correctly, but alwaus without the alignment, which is pretty important in my case.


I've tried with FME with limited success. I was able to retrieve text alignment, but each MTEXT carriage return was considered a new feature. That means if I have a 4 line MTEXT, this will create 4 points in a SHP or SDF.




Product Support
Posts: 185
Registered: ‎10-25-2011
Message 2 of 6 (341 Views)

Re: Export MTEXT alignment (justification) to SHP or SDF

12-02-2013 10:36 AM in reply to: mphaneuf

Hi Maxime,


I know that if you run a MAPEXPORT and look under the Feature Class tab > Select Attributes, you can find several Object Properties for MTEXT:

MAPEXPORT - Select Attributes.PNG


Unfortunately I don't see one for alignment, but maybe you can get the results you are looking for by using other parameters, such as the position parameters under Geometry?


And I'm sorry but I do not have any knowledge of FME to share.

Phil Borycens
*Expert Elite*
Posts: 1,600
Registered: ‎06-03-2011
Message 3 of 6 (339 Views)

Re: Export MTEXT alignment (justification) to SHP or SDF

12-02-2013 10:53 AM in reply to: mphaneuf

Well, I cannot understand this question, sir.

In a Gis environment, a shapefile is only a information carrier, without any "formatting" properties.

If you wanna improve the look of your text shape labels, you can stylize 'em in your Gis client.

For instance, Qgis allows labelling "on mouseover" a whole stack of point attributes.

Posts: 4
Registered: ‎06-05-2013
Message 4 of 6 (321 Views)

Re: Export MTEXT alignment (justification) to SHP or SDF

12-03-2013 08:47 AM in reply to: antoniovinci



I know what a SHP is. 


You answered your own interrogations in your answer. 


What I want to do is export MTEXT into SHP because I want to load them into SQL Server, and the only way I can do this right now is: Export to SHP - COnnect to SHP, Bulk Copy to SQL Server. Since all MTEXTs are not in the same alignment, I wanted to export the value of each alignment, so the anchor point will vary depending on the value. 


I'll probably have to do it by hand or create a script that compares MTEXT and SHP at the same location and load the alignment into the SHP column.




Distinguished Contributor
Posts: 146
Registered: ‎02-14-2009
Message 5 of 6 (316 Views)

Re: Export MTEXT alignment (justification) to SHP or SDF

12-03-2013 12:36 PM in reply to: mphaneuf



here is Lisp code to copy DXFcode 71 (justification) into OD : table=MTextJustif  Field=JUSTIF


; Création de la table Handle							;
(defun CreateTableHandle ( / tabldefn result )
  ;construit la table des parcelles si nécessaire
  (if (not (member "MTextJustif" (ade_odtablelist)))
    (setq tabldefn
      '(("tablename" . "MTextJustif")
	("tabledesc" . "MText Justification")
          ;Define a field
          (("colname" . "JUSTIF")
           ("coldesc" . "Justification")
           ("coltype" . "integer")
           ("defaultval" . 0))
    ;Create the new table
    (setq result (ade_oddefinetab tabldefn))
    (setq result T)

; Copie code 71 en OD								;
(defun C:MTextJustifToOD ()
  ;;; Crée la table
  ;boucle de sélection d'une polyligne
  (setq JEU (ssget (list (cons 0 "MTEXT")))   I 0)
  (repeat (sslength JEU)
    (setq oMText (ssname JEU I))
    (setq I (1+ I))
    ;; SI pas d'enregistrement sur cet objet ALORS ajoute l'enregistrement
    (if (= (ade_odrecordqty oMText "MTextJustif") 0)
      (if (not (ade_odaddrecord oMText "MTextJustif"))
        ; SI l'ajout de l'enregistrement s'est mal passé
        (alert "Pb à l'ajout de l'enregistrement")
    ); Fin test Enregistrement existe
    ; Met à jour le champ Commune
    (if (not (ade_odsetfield oMText "MTextJustif" "JUSTIF" 0 (cdr (assoc 71 (entget oMText)))))
      (alert "Pb : mis à jour du champ Justification impossible")

(alert "MTextJustifToOD")


Now you can export this information to SHP



Posts: 4
Registered: ‎06-05-2013
Message 6 of 6 (284 Views)

Re: Export MTEXT alignment (justification) to SHP or SDF

12-10-2013 01:12 PM in reply to: mphaneuf

Thank you, I'l try it this week!

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community