Creo Toolkit: how to fetch current Part, Assembly, Drawing - toolkit

Creo Toolkit: Need to know how to fetch current Part, Assembly, Drawing. Any information would be appreciated.

Use
ProModeCurrentGet()
and
ProMdlCurrentGet()

Not sure which toolkit you are using, if you are going with JAVA, the Toolkit API has multiple functions to fetch model(s).
GetActiveModel()
GetCurrentModel()
RetrieveModel(ModelDescriptor MdlDescr) ... and more.

Related

Handle large data and drawings - React Redux Immutable

I'm developing a software which is drawing some elements on the screen which is using by mechanical engineers.
I'm string my project data in reducer store. This project data has tons of objects, arrays etc. I mean for each element on the screen, there is a data stored in project.
When user makes an action, I must recalculate project and set it to redux store again for example;
...
case SET_ACTIVE_UNIT:
let unit = action.unit;
project = state.get('project').toJS(); //I'm using immutable
project = ProjectLogic.addActiveUnit(project, unit, action.shiftKey);
return state.set('project', fromJS(project));
...
Ok, you will say that this kind of usage is not right. Because I'm reading all data and reseting it to reducer whole data. You will advice me to use state.setIn but it is really imposible. Beacuse in addActiveUnit function will recalculate project, %20 of project data will be changed. So, I can't handle this change state.setIn
My problem starts here; if there is 60-80 elements drawing on the screen after return state.set('project', fromJS(project)); rendering performance slows down. Every new items gets it worse.
How can I handle this problem?
Thanks all
As a general observation, toJS() is considered to be the most expensive API in Immutable.js, and should be avoided as much as possible.
My initial advice would be to not use Immutable.js.
Instead, you might want to look at using immer to handle the immutable update logic.
Also, our new redux-starter-kit package uses Immer internally.
Beyond that, I'd suggest doing some profiling to see where exactly the perf bottlenecks actually are.

How to pass the system time to the Metal fragment function?

I am using SceneKit and SCNProgram to modify an object in the game scene, and I would like to get access to the system time in my fragment function in .metal file. I guess the way is to pass the time data from the SceneKit but it’s not quite clear for me how to do it.
The SCNSceneBuffer structure has a time property (see the documentation). This page also mentions ways to pass custom data from the CPU to a custom program, if you need to.

Where is DateTickUnit documentation?

I need to change the default DateTickUnit settings for different zoom levels for a TimeseriesChart, but can´t find the place i need to read in the documentation? I would greatly appreciate a pointer.
Here is the Java API for TimeSeriesChartDemo1: http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/demo/TimeSeriesChartDemo1.html
The zoom levels documentation will be found in one of the inherited methods. I would recommend finding the exact component that requires the zoom to be changed on. Then checking the API for that java.awt component
DateAxis has two static factories for creating standard date tick units. These methods, createStandardDateTickUnits(), describe how "to create your own collection." The setTickUnit() methods replace the default with your own DateTickUnit. The constructor having a DateFormat is particularly convenient.
If this is terra incognita, I'd recommend The JFreeChart Developer Guide†.
†Disclaimer: Not affiliated with Object Refinery Limited; just a satisfied customer and very minor contributor.

XPathNavigator in Silverlight

I have a code library that makes heavy use of XPathNavigator to parse some specific xml document. The xml document is cross-referenced, meaning that an element can reference another which has not yet been encountered during parsing:
<ElementA ...>
<DependentElementX id="1234">
</ElementA>
<ElementX id="1234" .../>
The document doesn't really look like this, but the point is that 1) there is an xml schema that enforces the overall document structure, 2) elements inside the document can reference each other using some IDs, and 3) there is quite a few such cross references between different elements in the document.
The document is parsed in two phases. In the first pass I walk through the document
XPathDocument doc = ...;
XPathNavigator nav = doc.CreateNavigator();
nav.MoveToRoot();
nav.MoveToFirstChild()...
and occasionally 'bookmark' the current position (element) in the document using XPathNavigator.Clone() method. This gives me a lightweight instance of an XPathNavigator which I can store somewhere and use later to jump back to a particular place (element) in my document.
Once I have enough information collected in the first pass (for example, I have made sure there is indeed an ElementX with an id='1234'), I jump back to saved bookmarks (using those saved XPathNavigators) and complete the parsing.
Well, now I'm about to use this library in Silverlight 3.0 and to my horror the XPathNavigator is not in the System.Xml assembly.
Questions:
1) Am I missing something obvious (i.e. XPathNavigator does exist in some shape or form, for example in a toolkit or a freeware library)?
2) If I do have to make modifications in the code, what would be the best way to go? Ideally, I would like to make minimal changes, not to rewrite 80% of the code just to be able to use something like XLinq.
To resume, in case I have to give up XPathNavigator, all I need is a way to bookmark places in my document and to get back to them so that I can continue to iterate from where I left off.
Thanks in advance for any help/ideas.
You are not missing something obvious, there is no implementation of XPathNavigator or XPathDocument in the Silverlight versions of the libraries.
The "best way to go" is highly subjective and would really depend on how many lines of code are really depending on XPathNavigator. However I see a couple of choices.
Go ahead and re-write the code using XDocument, XElement etc from the System.Xml.Linq namepsace. This may not be as bad a choice as you might think.
Wrap Xml-to-Linq objects in your own implementation of those properties and methods of the XPathNavigator that you are actually using. It shouldn't be too hard re-create most the features of the XPathNavigator against the Xml-to-Linq objects. You can then run your existing code against your own XPathNavigator.
XPath (xdoc.XPathSelectElements) is available in Silverlight 4: here's an online test tool.
There are tons of ways:
How to deal with XML in C#
You can still use Linq to XML just minus the linq syntax and use the Linq Extension methods.

DDD Alternative that also Draws Pretty Pictures of Data Structures

Is there anything other than DDD that will draw diagrams of my data structures like DDD does that runs on Linux?
ddd is okay and runs, just kind of has an old klunky feeling to it, just wanted to explore alternatives if there are any.
The top part with the grid of this image is what I am talking about:
Don't you mind to look here (list of GDB front-ends)?
I suggest this list should be useful.
I've used zero bugs a few times. It can do custom visualization. I don't know if allows the users to effect the gui elements or just how it displays in the text listings. Check it out, www.zero-bugs.com.
For those that wanted an answer; you are looking for KDBG.
ZeroBugs data visualizations can be customized via Python scripts. The debugger is now available as open source (and free as in free beer, it can be used for commercial purposes). Check it out at http://zerobugs.codeplex.com/

Resources