WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #15  
Old 09-25-2012, 09:13 AM
nabrahamson nabrahamson is offline
Member
 
Join Date: Sep 2011
Posts: 36
Definitely. Sorry for lack of information.

The problem seems to be that when I call insertGroupBelow on a node, that group replaces the node.

So here is what I'm doing:

Code:
	sub_instance = p.insertGroupBelow(subnode)
	sub_instance.parentNode = p.instanceName
        ''' this copies defined properties from the parent node to the sub node '''
	CADParser.copyParams(p, sub_instance)
	sub_instance.inCollide = []
The meat of the copyParams code looks like this:

Code:
def copyParams(src,dst):
	dst.instanceNumber = src.instanceNumber
	dst.instanceName = src.instanceName
	dst.partNumber = src.partNumber
	dst.anarkParent = src
	src.anarkGroup = True
	dst.anarkGroup = True
	param_list = ["anarkFreeMovement"
				, "anarkTrans"
				, "anarkRotate"
				, "anarkRehomePos"
				, "anarkRehomeOri"
				, "anarkDependency"
				, "anarkColor"
				, "anarkAlpha"
				, "anarkBackface"
				, "anarkShader"
				, "anarkDescription"
				, "anarkImage"
				, "anarkModule"
				, "anarkLocal"
				, "anarkTool"
				, "layerSpacing"
				, "anarkRequires"
				, "anarkModRotate"
				, "anarkRev"
				]

	for param in param_list:
		if hasattr(src, param):
			exec("dst." + param + " = src." + param)
		else:
			try:
				exec("del dst." + param)
			except:
				pass
	
	if hasattr(dst, "anarkColor"):
		src.color(dst.anarkColor)

	if hasattr(dst, "anarkShader"):
		if dst.anarkShader == "smoothmetal":
			reflect = viz.add('image2.jpg')
			dst.texture(reflect,'',1)
			dst.appearance(viz.TEXGEN,'',1)
	
	if hasattr(dst, "anarkRotate"):
		src.rotatingParent = dst
In another module, when I've got the handle on one of these groups created with the insertGroupBelow, I get an exception when trying to access a parameter like:

Code:
'''Only executed when this part has been marked as being an inserted group'''
print part.anarkParent
I get an exception saying that the attribute does not exist.
__________________
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Haptic touch texture coordinates yth Vizard 0 06-02-2012 03:40 AM
How do coordinates in IS900 thransform into coordinates in vizard's world jacky Vizard 1 08-11-2011 10:44 AM
child-objects in VRML-file all have the same coordinates Sven Vizard 4 06-09-2010 02:07 AM
viz.vertex coordinates lilio Vizard 6 05-16-2009 04:36 PM
Object rotating around world axis, not own axis tacbob Vizard 1 02-15-2007 09:12 AM


All times are GMT -7. The time now is 07:28 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC