2015年12月22日火曜日

Selecting or highlighting node or mesh by butto... | Adobe Community

https://forums.adobe.com/thread/1258268



Selecting or highlighting node or mesh by button using javascript


LOD_PROJECTS 2013/07/19 8:32

Hi

I have 3D pdf model with node 1001 or mesh name 2002 and when I klick
it by mouse on 3D view it is highlighted and get orange boundary box.

I have created button name 1001 button and I would like to add to this
button javascript function which will highlight this node or mesh in
the same way as click on those.



I found in discusion some way of make it for example red by changing
rendering mode to illustration but it is not what I am trying to do. I
asking if it is possible just select from button using name of node or
mesh. if you have any exmaple of script i will be very pleased.

1555 閲覧
タグ: 3d
3d でタグ付けされたコンテンツ
, javascript
javascript でタグ付けされたコンテンツ
, button
button でタグ付けされたコンテンツ
, 3dpdf
3dpdf でタグ付けされたコンテンツ
, model_tree
model_tree でタグ付けされたコンテンツ
, 3d_pdf
3d_pdf でタグ付けされたコンテンツ
返信する

Translate

平均ユーザー評価: 評価なし (0 評価)
平均ユーザー評価
評価なし
(0 評価)
評価:
評価 劣っている(1 : 5)評価 平均以下(2 : 5)評価 平均(3 : 5)評価 平均以上(4 : 5)評価 優れている(5 : 5)

1. Re: Selecting or highlighting node or mesh by button using javascript

mrfale67 2013/07/19 11:58 (LOD_PROJECTS への返信)

See what I was answered here:

http://forums.adobe.com/thread/1224570?tstart=0

Otherwise, if you know the name, simply use getByName().


I think what you are looking for may be the wireframeColor property
but I have never experienced it directly. Should you find how to
replicate the selection orange boundary box, please share the solution
with us.

「いいね!」 0 件の「いいね!」を表示(0)

返信する

アクション
Translate

2. Re: Selecting or highlighting node or mesh by button using javascript

LOD_PROJECTS 2013/07/19 15:28 (mrfale67 への返信)

thanks for answer.

It is not what I want to do

I have 5 layer and on each layer I have one node and under neath one mesh.

I would like to select node or mesh by clicking button created on page
not by clicking in 3d model or Model Tree. Like below bottles are
selected (highlighted).



NowI doing it like that:



BUTTON 1-----------------------------------------------

myAnnotObj = getAnnots3D(0)[0].context3D;
myAnnotObj.scene.defaultRenderOptions.illustrationRenderModeFaceColor.set(
1, 0, 0 );

for (var i = 0; i < myAnnotObj.scene.meshes.count; ++i)
{
mesh = myAnnotObj.scene.meshes.getByIndex(i);
mesh.renderMode = "solid";
}
HighlObj = myAnnotObj.scene.meshes.getByName("1001");
HighlObj.renderMode = "illustration";

---------------------------------------------------------------



BUTTON 2-----------------------------------------------

myAnnotObj = getAnnots3D(0)[0].context3D;
myAnnotObj.scene.defaultRenderOptions.illustrationRenderModeFaceColor.set(
1, 0, 0 );

for (var i = 0; i < myAnnotObj.scene.meshes.count; ++i)
{
mesh = myAnnotObj.scene.meshes.getByIndex(i);
mesh.renderMode = "solid";
}
HighlObj = myAnnotObj.scene.meshes.getByName("2002");
HighlObj.renderMode = "illustration";

---------------------------------------------------------------



in this method I have to clean old selection in the loop doing this
render mode back to solid. In the same time my selection not working
at all in render mode illustration. So I would like to find how to
select like in picture from button in document. by script.

「いいね!」 0 件の「いいね!」を表示(0)

返信する

アクション
Translate

3. Re: Selecting or highlighting node or mesh by button using javascript

mrfale67 2013/07/20 0:53 (LOD_PROJECTS への返信)

I think you are doing well.

Things I would try:

1) "for (var i = 0; i < myAnnotObj.scene.meshes.count; ++i)": I have
never seen "++i" but "i++"; are you sure you are parsing all meshes?
just try a "console.println("Mesh name " + mesh.name)" within the loop
to check for this; this way, you will also be assured of your mesh
name;

2) the reset loop is fine but I would also try "renderMode =
'default'" instead of "solid";

3) mesh obj has also a "material" property: in particular check
against "diffuseColor, diffuseTexture, emissiveColor, emissiveTexture,
opacityTexture"; I have heard they should be considered when dealing
with rendering;

let us know your progress

「いいね!」 0 件の「いいね!」を表示(0)

返信する

アクション
Translate

4. Re: Selecting or highlighting node or mesh by button using javascript

Dave Merchant 2013/07/20 3:21 (mrfale67 への返信)

Why is everyone trying to change the visual appearance of the model?



LOD_PROJECTS wants to set the active selection, so just do that:



scene.selectedNode = scene.meshes.getByName(' something' );

「いいね!」 0 件の「いいね!」を表示(0)

返信する

アクション
Translate

5. Re: Selecting or highlighting node or mesh by button using javascript

LOD_PROJECTS 2013/07/20 8:09 (Dave Merchant への返信)

Hi Dave,

Thank you that is exactly what I want and it works. Awesome.



mrfale67

After dave tip I shorten script in button from those above to:



myAnnotObj = getAnnots3D(0)[0].context3D;

myAnnotObj.scene.selectedNode = myAnnotObj.scene.meshes.getByName("1001");



and more in next button I can change rendering to illustration and
selected object is still selected.

many thanks guys

「いいね!」 0 件の「いいね!」を表示(0)

返信する

アクション
Translate

0 件のコメント:

コメントを投稿