Changing values in Cad Data Objects

Tips and tricks for Adept ACE

Changing values in Cad Data Objects

Postby Joerg.Vogel » Fri May 05, 2017 8:35 am

I am trying to manipulate the CAD Data objects inside the 3D Visualization window. The standard method is calling the remote program write to change a transformation by the variable "OffsetFromParent" or the visible state. I was able to change the color in ACE version 3.3.3.x for the imported 3D object simply by changing the string for the color name. In the ACE Version 3.6.3.2 I can't figure out how to change the color of the imported segments, since they are enumerated. Is the segment an object? Then how is the path described to the first, second or third segment. Or is the segment a part of the variable name. How is the syntax or the variable name to change the color?
Another important attribute is the path to the variable "Parent". I can change the path in the object window by the editing window, but how can I change the path by V+ code?

Here are some examples that work in Version 3.3.3.x
The CAD Data is stored in the path "/3D" and the object is called "Ball"
Code: Select all
        AUTO REAL status
        LOCAL LOC t.value
; activate visibility  - the second number "1" sets the visible state
        CALL rm.write.num("/3D/Ball", "Visible", 1, 1, status)
; change color by color name
        CALL rm.write.str("/3D/Ball", "Color", 1, "Blue", status)
; change offset transformation
        SET t.value = TRANS(-34.987,0,35.469,0,180,180)
        CALL rm.write.trns("/3D/Ball", "OffsetFromParent", 1, t.value, status)


Regards Jörg
Joerg.Vogel
 
Posts: 10
Joined: Tue Dec 06, 2011 5:13 am

Re: Changing values in Cad Data Objects

Postby stephano » Mon May 08, 2017 1:09 am

Hello Joerg,

you could use a C# script in ACE to change the properties of an CAD data object.

Here is an example that shows how to change the color of the CAD Object "Box":

cad.PNG
cad.PNG (109.22 KiB) Viewed 3962 times


Regards,
Stephan
stephano
 
Posts: 23
Joined: Fri Aug 09, 2013 12:49 am

Re: Changing values in Cad Data Objects

Postby Joerg.Vogel » Mon May 08, 2017 5:27 am

Hello Stephan, hello all,

I have adjusted your code and I can change the color. How can I execute this program from an V+ program. How do I make a call?

Code: Select all
using Ace.Core.Server.Sim3d;
using Ace.Core.Server;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;

// 3D CAD Data Directory: /3D; Imported STL-File named Ball
namespace Ace.Custom {
   
   public class Program {

      public AceServer ace;

      public void Main () {
         Trace.WriteLine("Script Starting");
         ICadData Ball =(ICadData) ace["/3D/Ball"];
         Ball.Segments[0].Color = Color.Blue;
         
      
         
      }
   }
}

Another problem is, that the color doesn't change in the 3D Visualization Window instantly. I have to close the window and after I have opened it again I can see the color change. Is there a command to refresh the screen or window. Which Library Class must I attach to the program to use the command.

Many Thanks!
Regards Jörg
Joerg.Vogel
 
Posts: 10
Joined: Tue Dec 06, 2011 5:13 am

Re: Changing values in Cad Data Objects

Postby Joerg.Vogel » Mon May 08, 2017 8:04 am

The V+ command is in fact a remote program call. The Parameters are the path to the script object as a string, command as a string, number of arguments to execute in the script, arguments as a string array, wait time, and the status as a return value.

CALL rm.execute("/SmartController /C# change3dcolor", "Execute", 0, $args[], 1, status)


I am still interested to update or refresh the 3D Visualization Window by V+ or C# source code.

Regards Jörg
Joerg.Vogel
 
Posts: 10
Joined: Tue Dec 06, 2011 5:13 am

Re: Changing values in Cad Data Objects

Postby stephano » Tue May 09, 2017 3:17 am

Hello Joerg,

in my workspace I can see the color change directly after I executed the c# script. The 3d window shoul be automatically be refreshed. There is no need to refresh the 3d window. I used ACE 3.6.3.2.

I uploaded the workspace here:
https://we.tl/xIDsE2pxNe

Regards,
Stephan
stephano
 
Posts: 23
Joined: Fri Aug 09, 2013 12:49 am

Re: Changing values in Cad Data Objects

Postby Joerg.Vogel » Fri May 12, 2017 10:20 am

Stephan,
you are right. It works in my workspace, too.


Many Thanks.
Joerg
Joerg.Vogel
 
Posts: 10
Joined: Tue Dec 06, 2011 5:13 am


Return to Adept ACE

Who is online

Users browsing this forum: No registered users and 2 guests