Results 1 to 2 of 2

Thread: AutoCad C3D - Trying to Automate MAPEXPORT to include Attribute Data from data table

  1. #1
    Member
    Join Date
    2017-10
    Posts
    7
    Login to Give a bone
    0

    Default AutoCad C3D - Trying to Automate MAPEXPORT to include Attribute Data from data table

    Hi,
    I have 3 drawings, each with 50+ layers. The client wants me to export each individual layer as an individual SHP file, and needs me to run the export every couple of months. I can write up a script file specifying each layer etc, the catch is that I also need to export the Attribute Data from the attached data tables for each item. I cannot seem to get a hook into the Attribute Data\Object Data using the MAPEXPORT command in a script, e,g:

    Code:
    -mapexport" "SHP" "c:\\Temp\\MyLayer1.shp" "Y" "c:\\Temp\\Street.epf" "S" "L" "All" "MYLAYER1" "*" "No" "Proceed"
    -mapexport" "SHP" "c:\\Temp\\MyLayer2.shp" "Y" "c:\\Temp\\Street.epf" "S" "L" "All" "MYLAYER2" "*" "No" "Proceed"
    This will export my layers, but minus the Attribute Data from the attribute table.

    Does anyone have experience in doing this kind of export to SHP? Is it possible to script, or code so that the shapefile contains the Attribute Data?

    I tried something along the lines of:

    Code:
    -mapexport" "SHP" "c:\\Temp\\MyLayer2.shp" "Y" "c:\\Temp\\Street.epf" "S" "L" "All" "MYLAYER2" "*" "No" "D" "MyDataTable" "Proceed"
    But this was just a stab in the dark, I cannot find any documentation outlining the datatable in the command line use of MAPEXPORT.

    Note: I can export the shapefile manually and select the data table and it exports as I need it to (by selecting the Data tab in the export dialogue).

    I have very limited knowledge of Lisp.

    I hope I have explained my issue well enough. Thanks for any help.

  2. #2
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,096
    Login to Give a bone
    0

    Default Re: AutoCad C3D - Trying to Automate MAPEXPORT to include Attribute Data from data table

    The Data option of the -mapexport command does not ask for the data table to use. That is defined in your loaded profile. Your loaded profile can also set the selection to all on the specific layer.

    If you want to understand a bit more on your profiles, open one in an XML file viewer/editor.

    See if this works for you. You will need to adjust the strings for the storage and profile paths. This code will only export layers that have an associated profile saved. Each profile has the selection type set to all of the object types (i.e.: Point, Line, Polygon, or Text) for that layer and the data table associated with that layer.
    Code:
    (defun c:ExportToShp (/ sStoragePath sProfilePath)
      (setq	sStoragePath "C:\\Temp\\SHP\\Data\\"
    	sProfilePath "C:\\Temp\\SHP\\Profiles\\"
      )
      (vlax-for n (vla-get-layers
    		(vla-get-activedocument (vlax-get-acad-object))
    	      )
        (if	(and (findfile (strcat sProfilePath (vla-get-name n) ".epf"))
    	     (not (findfile (strcat sStoragePath (vla-get-name n) ".shp")))
    	     )
          (command "-mapexport"
    	       "SHP"
    	       (strcat sStoragePath (vla-get-name n) ".shp")
    	       "Y"
    	       (strcat sProfilePath (vla-get-name n) ".epf")
    	       "P"
          )
        )
      )
    )
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

Similar Threads

  1. 2012 coordinate conversion during mapimport or mapexport
    By dmingo in forum AutoCAD Map 3D - Import/Export
    Replies: 0
    Last Post: 2013-09-20, 02:19 PM
  2. 2012: Where can I find the equivalent of or the file itself in C3D - MapExport.ini??
    By unkleroy in forum AutoCAD Civil 3D - General
    Replies: 1
    Last Post: 2013-02-22, 09:07 PM
  3. Replies: 0
    Last Post: 2012-05-11, 09:12 PM
  4. Problem in mapexport command with epf.
    By hildevasco429126 in forum AutoLISP
    Replies: 0
    Last Post: 2010-11-12, 10:55 AM
  5. Trying to automate layer tagging.
    By jmccracken.202999 in forum AutoCAD Customization
    Replies: 1
    Last Post: 2008-12-09, 12:55 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •