Subscribe to this thread
Home - General / All posts - Assign projection to many components
tjhb
10,094 post(s)
#20-Dec-10 02:55

There have been different approaches to this before, in several threads.

Code posted here relied on the projection of an arbitrary component having been verified. It would then apply the projection to all components.

The scripts below rely instead on a selection in the Project pane, which I think is more intuitive.

The first script, "Assign same projection for folder", assigns the projection of the selected component to all components in the same folder.

The second, "Assign same projection for project", assigns the projection of the selected component to all components in the project.

The projection of the selected component must have been verified.

In both cases there is an option to override other projections that have already been verified, or to leave them as they are (the default).

As before, local offsets and scales are not affected.

These scripts are easiest to use as add-ins. To use them ad-hoc, you need to run them from their own window, so that a target can be selected in the Project pane.

Attachments:
Assign same projection for folder.txt
Assign same projection for project.txt

tjhb
10,094 post(s)
#20-Dec-10 03:30

This is fussy, but a couple of comments weren't quite right. Scripts replaced below.

Attachments:
Assign same projection for folder.txt
Assign same projection for project.txt

orerockon

392 post(s)
#20-Dec-10 07:19

Wonderful! I had messed up a map file using the old script which overwrote already assigned projections LOL! Does this look right for to add the script as an add-in?

<xml>

<addin>

<name>Assign projection to all drawings in a folder Add-In</name>

<description>Assign projections to drawings in a folder</description>

<command>

<name>Assign projections to drawings in a folder</name>

<path>Assign projections to drawings in a folder.txt</path>

<scriptEngine>VBScript</scriptEngine>

</command>

</addin>

<addin>

<name>Assign projection to all drawings in a project Add-In</name>

<description>Assign projections to drawings in a project</description>

<command>

<name>Assign projections to drawings in a project</name>

<path>Assign projections to drawings in a project.txt</path>

<scriptEngine>VBScript</scriptEngine>

</command>

</addin>

</xml>

tjhb
10,094 post(s)
#20-Dec-10 12:51

I should have thought of that. Your xml looks fine and tests OK in IE. I've attached a bundle with matched filenames.

(Sorry the old script caused you grief.)

Attachments:
Assign projection for project or folder.zip

orerockon

392 post(s)
#20-Dec-10 13:47

No problems, ref my question about recovering a map file from the windows temp directory

and thanks again!

elmarsaathoff3 post(s)
#21-Feb-11 22:42

Great Script, thanks.

However, I presently have the problem that I would need a script that also changes the local offsets and scales. Would you have an idea how to incorporate that into the scripts?

tjhb
10,094 post(s)
#21-Feb-11 22:59

That's straighforward but—forgive my paranoia—I wouldn't want to post the adjusted script because it could so easily make a complete mess of someone's data, if they used it without noticing the difference.

Can you email me for a version that ignores local values?

elmarsaathoff3 post(s)
#23-Feb-11 08:05

Thanks Tim for this would be very nice.

I have just sent you an email, but just to be sure, my email adress is

elmarsaathoff@web.de

Thanks and regards, Elmar

tjhb
10,094 post(s)
#23-Feb-11 08:47

OK Elmar duly sent.

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.