Subscribe to this thread
Home - General / All posts - Adding all Components from a folder to a map
klausk115 post(s)
#22-Jan-15 16:20

Is it possible to put alle Components from a folder "Import" to a existing map called "Map" via script?? The folder "Import" have a lot of aerial views, which I have to put into the "Map".

thx in advance

firsttube


1,439 post(s)
#22-Jan-15 19:31

This script will add all drawings and images that are inside a folder named "Import" onto a map named "Map"

'vbscript

 

 

Sub Main

 set comps = document.componentset

 set fld = comps("Import")

 set childs = fld.Children

 set map = comps("Map")

 set lyrs = map.Layerset

 for each c in childs

  if c.Type = ComponentDrawing or c.Type = ComponentImage then

   test = 0

   'check if the component is already on the map

   for each l in lyrs

    if l.Component.Name = c.Name then

     test = test + 1

    end if

   next

   if test = 0 then

    'the component is not on the map so add it

    set newLyr = document.newLayer(c)

    lyrs.Add newLyr

   end if

  end if

  set lyrs = map.LayerSet

 next

End Sub

 

 

 

 

 


"The blessing in life is finding the torture you are comfortable with." - Jerry Seinfeld, 6/26/2013

klausk115 post(s)
#23-Jan-15 08:13

thx, your script makes a great job. Shows your picture Ted Nugent? When I was young I habe been a fan of him.

firsttube


1,439 post(s)
#23-Jan-15 13:48

You're welcome. No, that picture is none other than Mr. Frank Zappa, the Italian virtuoso composer extraordinaire.


"The blessing in life is finding the torture you are comfortable with." - Jerry Seinfeld, 6/26/2013

mdsumner


4,260 post(s)
#23-Jan-15 20:03

Your place or mine?


https://github.com/mdsumner

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