#1
|
|||
|
|||
artoolkit load 3d objects into application
greetings
i've found an example code on how to save a marker pattern on the resource directory. it works ! i love it. and i wonder is it possible to create a menu where user can load desired pattern and 3d objects into the application? let say this is the initial code #Create marker from pattern file marker = camera.addMatrixMarker(0, width=1000) #Add model model = viz.add('ball.ive') #Link model to marker sensor viz.link(marker,model) okay now how can i create a GUI menu where i can use to load the saved marker and 3d objects so that the updated code would be #Create marker from pattern file marker = camera.addMatrixMarker(0, width=1000) marker = camera.addMarker('new.patt', width=1000) #Add model model = viz.add('ball.ive') model2=viz.add('secondball.ive') #Link model to marker sensor viz.link(marker,model) viz.link(marker2,model2) is it possible to do so? i've created the dropdown menu as below #Create a menu subject MainMenu = menu.add( 'Main Menu' ) #Main Menu #Add dropdown list of theme options to Main menu themeDropDown = MainMenu.add( viz.DROPLIST, 'Model') themeDropDown.addItems( ['Import','Delete','Edit'] ) i'm a beginner. i never use python before. so i dont know how to put action handling into the menu. if it can save a pattern. i think it is possible to load a pattern and 3d objects too. please help. i want to add and make the artoolkit more interactive. any suggestion on how to do it ? thanks |
#2
|
|||
|
|||
The vizmenu example script found in the example/graphicalUserInterface folder of the Vizard installation shows how to handle events for the different GUIs added to the menu. You can register a callback function for a GUI event where you can load the marker and model associated with the selection.
|
#3
|
|||
|
|||
xcuddlex, is it possible to tell me where you did find the code on how to save a marker pattern ? Couldn't find any help on it and I'm interested in it for a project.
Thanks |
#4
|
|||
|
|||
That script is called artoolkit_createPattern.py and it can be found in the examples -> artoolkit folder of the Vizard installation.
|
#5
|
|||
|
|||
Thanks I have it (it was pretty obvious though ...).
But I have trouble when using a pattern I saved on the ressource directory in an other application. I have the message : " **ERROR: Failed to load AR pattern: 'C:\Prog[...]' " Is it because of the name or the extension of my file (I tried many different names) ? Thanks for your help |
#6
|
|||
|
|||
Problem solved, I was juste trying to load a MultiMarker instead of a Marker ...
Thanks anyway |
#7
|
|||
|
|||
jeff or anyone who are willing to help,
can you provide a sample code on how i can load a marker that i have saved ? i dont have any idea on how to do it. python is really hard. |
#8
|
|||
|
|||
You should be able to load a saved marker using the addMarker command with the name you gave it. Does that work for you?
Code:
#Create camera using first available webcam camera = ar.addWebCamera() #Create marker from pattern file marker = camera.addMarker('myPattern',width=1000) |
#9
|
|||
|
|||
hi jeff, yes it works
but i wanted to do a function where i can load it directly from my application this is the code i found in the vizard resources #Update raw pattern every frame vizact.onupdate(viz.PRIORITY_INPUT-1,UpdateLargestMarker) def SavePattern(): """Displays save dialog for creating pattern from largest raw marker""" if camera.largestMarker is not None: parent = win32ui.CreateWindowFromHandle(viz.window.getHandl e()) dlg = win32ui.CreateFileDialog(0,None,None,0,None,parent ) if dlg.DoModal() == win32con.IDOK: camera.savePattern(dlg.GetPathName(),camera.larges tMarker) #Save current pattern when spacebar is pressed vizact.onkeyup(' ',SavePattern) i want to do the same thing for loading the saved pattern for example, press ctrl+w to load pattern but i dont have any idea how to do it because i never used python before can you provide me any clue on how to do it jeff ? pseudocode is okay too. i'll try to figure it out, thanks for the reply. really appreciate it |
Tags |
3d model, artoolkit, gui, load, pattern |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Trouble picking text3d objects | Salvar | Vizard | 4 | 12-01-2010 03:07 PM |
Semi-circle array containing target and distractor objects | ptjt255 | Vizard | 3 | 08-04-2009 03:09 AM |
Lightwave objects rotation problem | hosier | Vizard | 6 | 02-13-2009 12:04 PM |
Improve performance with large number of onthefly objects? | Fox5 | Vizard | 7 | 04-28-2008 05:19 PM |
Could not find plugin to load objects... | halley | Vizard | 1 | 05-30-2006 11:01 AM |