Subscribe to this thread
Home - General / All posts - duplicate/multiply points automatically
jersonics27 post(s)
#04-Sep-14 08:42

Hi, can you teach me how to duplicate or multiply a certain point (drawing). Like, i want to duplicate the point 50times, (instead of copying and pasting it 50x)

thanks.

jersonics

adaptagis

633 post(s)
#04-Sep-14 12:04

hi there

If it is only for a simple project I would go into the table of the drawing and put view columns for Lat Long

then copy this table and past it into an Excel file. there I would drag down the line to reach the amont of required Points.

the Excel table Import as table into manifold and copy the table to paste it as drawing with Lat Long activated.

not very elegant but takes about 4 min..

jersonics27 post(s)
#04-Sep-14 14:19

thanks but, is there any other way to do it automatically or any method in Manifold to replicate the point itself or even area/polygon automatically say 50x? it's because i need to create 1:1 relation from a certain table equal to the number points or polygons.

thanks.

cartomatic

905 post(s)
#04-Sep-14 14:42

reverse your query logic and join geoms to your multiple rec table. then just link a drawing to your query.


maps made easy - www.cartomatic.pl || www.cartoninjas.net

firsttube


1,439 post(s)
#04-Sep-14 15:27

This script duplicates a point in a drawing 50 times. The drawing has one point in it and is called "Drawing".

'vbscript

Sub Main

 set comps = document.componentset

 set d = comps("Drawing")

 set objs = d.ObjectSet

 set obj = objs.Item(0).Geom

 for i = 1 to 50

  objs.Add obj

 next

End Sub


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

jersonics27 post(s)
#04-Sep-14 15:43

Great! thanks firsttube, how about if i want to select any object then run your script, what's the new vbscript for this? coz i dont want to copy anymore the selected object and paste it as "Drawing" on the project pane, is it possible?

firsttube


1,439 post(s)
#04-Sep-14 16:22

This script will be slow if your drawing has thousands of objects. Also, it only duplicates the drawing object, not the data in the object's record.

Enter the drawing name. Enter the number of duplications you want.

'vbscript

Sub Main

 set comps = document.componentset

 dwgName = application.inputbox("Enter drawing name:","Drawing name")

 numDupes = application.inputbox("Enter number of times to duplicate:","Number")

 if dwgName = "" or numDupes = "" then

  application.messagebox "Must enter both parameters!""Error"

  exit sub

 else

  dTest = False

  for each comp in comps

   if comp.Name = dwgName then

    dTest = True

   end if

  next

  if dTest <> True then

   application.messagebox "That component does not exist.","Error"

   exit sub

  else

   if isnumeric(numDupes) <> True then

    application.messagebox "Must enter numeric value!""Error"

    exit sub

   else

 

    set d = comps(dwgName)

    set objs = d.ObjectSet

    test = False

    num = 0

    for each obj in objs

     if obj.Selected = True then

      test = True

      num = num + 1

      set theObj = obj.Geom

     end if

    next

    if test = False then

     application.messagebox "No object selected","Error"

     exit sub

    else

     if num > 1 then

      application.messagebox "Too many objects selected, only select 1","Error"

      exit sub

     else

      for i = 1 to cint(numDupes)

       objs.Add theObj

      next

      application.messagebox "Done! " & numDupes & " objects added.""Status"

     end if

    end if

   end if

  end if

 end if

End Sub


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

jersonics27 post(s)
#04-Sep-14 23:27

wow this is awesome, really programming! thank u thank u...this really helps.

regards,

jersonics

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