Inserting + combining many, many mapping DWGs to exact co-ordinates in a single file
Hi All,
I hope this belongs here, please let me know if not.
My traffic management company uses CentreMapsLive to purchase mapping for each job that comes in. Now, after many years of us doing this we are finding that we may mistakenly purchase mapping for an area we have already covered. I have suggested to my department that if we were to take ALL the mapping we've ever bought, and put this into a single DWG so that we can 'quickly' check if there are any crossovers.
I understand that this file would probably be huge, but that feels like a separate issue.
Mainly, I'm looking to find out if the mapping data that is provided to us from CML contains metadata that allows for precise co-ordinate placement? Because in theory all I'd have to do is import each set one-by-one (tedious yes, but potentially lucrative) until we have a nice large map file.
My question, really, lies within whether or not we think this might be possible? What tools does Bricscad have that would allow for a smooth combining of all these DWGs... Is there an automatic process that could pull the data and paste it in the correct location?
- The scale will be the same for all DWGs
- I could look at reducing the file size, freezing layers etc, but that's not my biggest concern.
Is it possible? Do we reckon it might take maaaaany man-hours or is this something that could be compiled relatively easily?
many thanks folks, and appreciate the essay.
S&B
I have attached a basic example of the kind of mapping, and would really appreciate if someone a bit more tech-savvy could tell me if such information is present? I wouldn't even know where to start...
I hope this belongs here, please let me know if not.
My traffic management company uses CentreMapsLive to purchase mapping for each job that comes in. Now, after many years of us doing this we are finding that we may mistakenly purchase mapping for an area we have already covered. I have suggested to my department that if we were to take ALL the mapping we've ever bought, and put this into a single DWG so that we can 'quickly' check if there are any crossovers.
I understand that this file would probably be huge, but that feels like a separate issue.
Mainly, I'm looking to find out if the mapping data that is provided to us from CML contains metadata that allows for precise co-ordinate placement? Because in theory all I'd have to do is import each set one-by-one (tedious yes, but potentially lucrative) until we have a nice large map file.
My question, really, lies within whether or not we think this might be possible? What tools does Bricscad have that would allow for a smooth combining of all these DWGs... Is there an automatic process that could pull the data and paste it in the correct location?
- The scale will be the same for all DWGs
- I could look at reducing the file size, freezing layers etc, but that's not my biggest concern.
Is it possible? Do we reckon it might take maaaaany man-hours or is this something that could be compiled relatively easily?
many thanks folks, and appreciate the essay.
S&B
I have attached a basic example of the kind of mapping, and would really appreciate if someone a bit more tech-savvy could tell me if such information is present? I wouldn't even know where to start...
0
Comments
-
Yeah, you can do this with PyRx, if you are able to load https://github.com/CEXT-Dan/PyRx, then, place all the sub maps in a folder and run merge_dwgs
from pyrx import Rx, Ge, Gi, Db, Ap, Ed, Aximport os, pathlibimport tracebackimport wxdef getDrawingsFromFolder():fpaths = []dlg = wx.DirDialog(None, "Choose input directory", "", wx.DD_DIR_MUST_EXIST)if dlg.ShowModal() != wx.ID_OK:raise RuntimeError("You Cancelled The Dialog!")dwgex = ".dwg".casefold()for fname in next(os.walk(dlg.GetPath()), (None, None, []))[2]:if dwgex == pathlib.Path(fname).suffix.casefold():fpaths.append("{}\\{}".format(dlg.GetPath(), fname))return fpathsdef wblock(curdb: Db.Database, sideDb: Db.Database):smodel = Db.BlockTableRecord(sideDb.modelSpaceId())sideDb.wblockByRef(curdb, smodel.objectIds(), smodel.origin(), Db.kDrcIgnore)def cloneSideDrawing(curdb: Db.Database, path: str):print("\nProcessing {} ".format(path))sideDb = Db.Database(False, True)sideDb.readDwgFile(path)sideDb.closeInput(True)wblock(curdb, sideDb)@Ap.Command()def merge_dwgs():try:db = Db.curDb()for path in getDrawingsFromFolder():cloneSideDrawing(db, path)axApp = Ap.Application.acadApplication()axDoc = axApp.activeDocument()axDoc.purgeAll()print("\nDone! ")except Exception as err:traceback.print_exception(err)
2 -
May need to add a filter so you don’t copy your copyright and coordinate labels every time, good you have them on their own layers, so that would be easy to add, I can help you that if you are able to run the routine
0 -
Have at times looked at this task and thought one way around it using grids, click on a grid and the correct map is inserted if it exists. Bring all maps in may make a huge dwg which is not needed. The grid would be at real world co-ordinates. In your dwg click inside a grid and look for images with a certain name prefix.
We used JPG with a JGW file and a lisp that used the jgw to convert and scale to a real world location.
Yes the images need to be named in some way so can be inserted easily.
eg 363800-190900-1, 363800-190900-2, 363800-190900-3, 3 images in a grid square with different areas1 -
Its_Alive said:
Yeah, you can do this with PyRx, if you are able to load https://github.com/CEXT-Dan/PyRx, then, place all the sub maps in a folder and run merge_dwgs
from pyrx import Rx, Ge, Gi, Db, Ap, Ed, Aximport os, pathlibimport tracebackimport wxdef getDrawingsFromFolder():fpaths = []dlg = wx.DirDialog(None, "Choose input directory", "", wx.DD_DIR_MUST_EXIST)if dlg.ShowModal() != wx.ID_OK:raise RuntimeError("You Cancelled The Dialog!")dwgex = ".dwg".casefold()for fname in next(os.walk(dlg.GetPath()), (None, None, []))[2]:if dwgex == pathlib.Path(fname).suffix.casefold():fpaths.append("{}\\{}".format(dlg.GetPath(), fname))return fpathsdef cloneSideDrawing(curdb: Db.Database, path: str):print("\nProcessing {} ".format(path))sideDb = Db.Database(False, True)sideDb.readDwgFile(path)sideDb.closeInput(True)smodel = Db.BlockTableRecord(sideDb.modelSpaceId())sideDb.wblockByRef(curdb, smodel.objectIds(), smodel.origin(), Db.kDrcIgnore)@Ap.Command()def merge_dwgs():try:db = Db.curDb()for path in getDrawingsFromFolder():cloneSideDrawing(db, path)axApp = Ap.Application.acadApplication()axDoc = axApp.activeDocument()axDoc.purgeAll()print("\nDone! ")except Exception as err:traceback.print_exception(err)
So, if I were to put all the 'mastermaps' into a single folder, and got my company's cyber security to... download PYRX? I'm sorry I'm really not sure what I'm looking at here. Will this require admin control to install the program, or is Python already installed on all PCs and I just have to open the command console or something? Sorry I wish I could ask for a step by step tutorial but really I should be counting my lucky stars that I had two brilliant forum members respond to my post between 12-3am!
Many thanks in advance0 -
Yeah, might be too much trouble if your company doesn’t allow installing, or if your not used to scripting, I think someone could write something similar in AutoLISP using insert and explode?But just in case you want to give it a whirl…Make sure we are on the same page before you begin. The routine will merge the model spaces of a collection of drawings located in a folder, into the current drawing, while preserving their properties. Currently, the routine will not drill into nested folders.It’s all opensource, nothing requires admin privileges. Have your company's cyber security look at the project, don’t miss the “Data privacy, User control and trust” section in the wiki.
- Install Python 3.12.XX as shown on the PyRx page
- open a console and type “pip install cad-pyrx”
- start BricsCAD, type appload,
navigate to %localappdata%\Programs\Python\Python312\Lib\site-packages\pyrx\RxLoaderV25.0.brx
check the autoload box if applicable
- create a text file in some folder where you would like to store your scripts I.e. “merge_dwgs.py”
- type pyload in BricsCAD and load merge_dwgs.py
- run the new merge_dwgs command in BrisCADafter that, you would load python scripts with pyload, kinda like lispCheers~Dan
1 -
Assuming all the data from CentreMapsLive is to the same Mapgrid, then you could create a new drawing to host your mapping drawings, then use XATTACH to xref the mapping files in bulk. This command will allow you to select multiple files to attach. The limitation is that they will all come in with the same insertion point, rotation, scale.
I think the option to attach multiple files with XATTACH is a BricsCAD only feature. It is also available with IMAGEATTACH. In this case, if the images have geocoding available, then they will be used to place the images in the correct location.Jason Bourhill
CAD Concepts Ltd
cadconcepts.co.nz1 -
Like Jason's suggestion, I had a dwg "where is that person" a staff map with around 60 images each image was labelled as the phone number, in the dwg where phone number blocks. The image would sit on the phone number.
Using a xref is best idea again as I suggested have a grid and just pick a grid then xref in the correct images.
I still think you don't need one big dwg only those relevant to your current dwg location. You could name a dwg with say center co-ords so can get a list of all dwg's in a directory and find any dwgs with a matching co-ord name as prefix. Once found remove the GRID Xref.
We had a image in nearly every project, Civil, sometimes more than one to keep image sizes down. Could only get rectang images.
1