hi guys,
i hope you can help me with this problem.
i have a vsd file with several shapes. by code i copy-paste each shape to a different vsd file. since the paste command throw the shape to an arbitrary position, i use the Selection.move command to move the shape to the same position as in the original vsd file. at the end, the file indeed looks the same as the original file but the problem is the order of the shapes. when i do the move command, the moved shape jumps to be the first shape (shapes.getItemU(1)). so eventually the order of the shapes in both files is not the same even though they look the same. it's important for the code that the order will remain the same. any idea how to make it work?
thanks in advance.
David
tower of hanoi ;)
I would copy all 4...note them as needed....then on the new do the select/move/fwd/backward in the original shape order (reverse order to the copy/paste).
copy 1,2,3,4 and move / bring to front 4,3,2,1.......will yeild 1,2,3,4
sorry i didn't understand your answer...
i would just like to move a shape without changing its order in shapes. is that possible?
By order, do you mean "id", e.g., sheet.1, sheet.2, or order in the "z-direction", i.e., which shape appears on top of another?
For example, if you select shape, sheet.6, and place it in on a new page in either new file or existing file, and if it is the 1st placed on that page, it will become sheet.1 and the "lowest" z-direction order. If shape, sheet.4 is selected next and placed, it will become sheet.2, and will be on top of sheet.1 on the new page. Two potential issues, then: 1.) shape id's get changed and re-ordered, and 2.) z-direction ordering is changed. (But, should match the placement order.)
I haven't done this with code, so I don't know if the selection.move command works differently, but it would be surprising if it did. It should only react to the order as created on the page in question.
Have you given thought to selecting and pasting all shapes? That would preserve the id, order, and position. Then, if needed, go thru and eliminate what is unwanted? Yeah, assumes there isn't a lot of shapes.
Something to consider...
Wapperdude
hi Wapperdude,
selecting and pasting all shapes won't work since the paste function drops the shapes in an arbitrary place, i need to use the move command for all the shapes at once. i tried it and they all move to the same spot. definitelly not what i meant.
the way i see it, i have to copy-paste each shape.
by order, i meant that shapes.get_itemU(i) in both vsd files will be the same shape for every i.
still stuck with it.
anyone has any idea?
id is not guarenteed to be linear. You should really look at doing in order of the shape selections
this is an order problem like the towers of hanoi. Read up on that and you will see what you have to do
Something like
Do while shapes in selection
pick a shape
copy
paste
move
remember the shape ...aka asign to a temp variable....1 per shape
next shape
do while temp shape
pick last shape in list
set priority (front back or whatever)
previous temp shape
end
this should set the same precedence as found on the first shape...regardless of ID numbers or ordering on top of each other
Hello,
some suggestions:
1)
Don't use the ShapeID like you do! Like vojo answer implied, Visio can change thoose at will.
You should give your shapes a user defined cell, where you place an selfmade ID number. Use that to identify the shape.
2)
In your code, you can then copy all shapes at once and compare the originals and copies with that number and apoint the PinX and PinY of the originals to the copies.
-----------
3) If you really want to stick with the shape IDs, you look at a real lot of fun in coding and got no guaranty it works:
- Make an Integer array to store the IDs of every original shape.
- Go through all original shapes and store theire IDs in the array.
- Sort the array from small to big.
- Make a loop from (0 or 1?) to the max ID value
-- For each number in the loop:
-- Look if that number is in the array
--- If Yes: Copy (and move) the shape with that ID
--- If No: Copy a dummy shape (that is later deleted)
- After the loop delete all dummy shapes, hopefully the shapeIDs from all the other shapes don't get sorted anew by visio.
(- If you haven't already moved the shapes, do it know)
Browser ID: smf
(is_webkit)
Templates: 1:
Printpage (default).
Sub templates: 4:
init,
print_above,
main,
print_below.
Language files: 1:
index+Modifications.english (default).
Style sheets: 0:
.
Hooks called: 66 (
showintegrate_autoload, cache_get_data, integrate_pre_load, integrate_load_session, integrate_verify_user, cache_get_data, integrate_user_info, integrate_load_board, cache_get_data, integrate_board_info, cache_get_data, integrate_allowed_to_general, integrate_allowed_to_general, integrate_boards_allowed_to, integrate_mod_cache, integrate_allowed_to_general, integrate_pre_load_theme, cache_get_data, integrate_allowed_to_general, integrate_simple_actions, integrate_allowed_to_general, integrate_load_theme, integrate_pre_log_stats, cache_get_data, integrate_actions, integrate_pre_parsebbc, integrate_bbc_codes, integrate_bbc_print, integrate_post_parsebbc, integrate_pre_parsebbc, integrate_bbc_print, integrate_post_parsebbc, integrate_pre_parsebbc, integrate_bbc_print, integrate_post_parsebbc, integrate_pre_parsebbc, integrate_bbc_print, integrate_post_parsebbc, integrate_pre_parsebbc, integrate_bbc_print, integrate_post_parsebbc, integrate_pre_parsebbc, integrate_bbc_print, integrate_post_parsebbc, integrate_pre_parsebbc, integrate_bbc_print, integrate_post_parsebbc, integrate_pre_parsebbc, integrate_bbc_print, integrate_post_parsebbc, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general, integrate_menu_buttons, integrate_current_action, integrate_theme_context, integrate_allowed_to_general, integrate_allowed_to_general, integrate_allowed_to_general)
Files included: 25 - 925KB. (
show/home/iw0lkfe3x6cq/public_html/vgforum/index.php, /home/iw0lkfe3x6cq/public_html/vgforum/Settings.php, /home/iw0lkfe3x6cq/public_html/vgforum/cache/db_last_error.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/QueryString.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Subs.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Subs-Auth.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Errors.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Load.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Security.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Subs-Compat.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Subs-Db-mysql.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Cache/CacheApi.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Cache/CacheApiInterface.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Cache/APIs/FileBased.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Subs-Charset.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Unicode/Metadata.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Unicode/QuickCheck.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Session.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Logging.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Class-BrowserDetect.php, (Current Theme)/languages/index.english.php, (Current Theme)/languages/Modifications.english.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Printpage.php, (Current Theme)/Printpage.template.php, /home/iw0lkfe3x6cq/public_html/vgforum/Sources/Unicode/CaseUpper.php)
Memory used: 748KB.
Tokens:
post-login.
Cache hits: 8: 0.00129s for 22,301 bytes (
showget modSettings: 0.00047s - 19982 bytes, get known_languages: 0.00023s - 1277 bytes, get board_parents-0: 0.00011s - 2 bytes, get permissions:-1: 0.00009s - 50 bytes, get theme_settings-1: 0.00011s - 980 bytes, get hostlookup-216.73.216.125: 0.00003s - 0 bytes, get log_online-update: 0.00023s - 10 bytes, get menu_buttons--1-english: 0.00002s - 0 bytes)
Cache misses: 2: (
showget hostlookup-216.73.216.125, get menu_buttons--1-english)
Queries used: 11.
[Show Queries]