ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
|
Downloads |
Q&A Using Flexsim and building models |
#1
|
|||
|
|||
how to keep the Positional relation between frame and the new crane object ?
hi
i am building a model which contain a object like crane ,but the object has two trolleys so that it can carry a long product. and the two trolleys have some Collaborative actions. so i think i should use the BasicTE to build a new object to meet it's function needs . now i almostly have buit that object like crane ,and most codes i wrote in Basic TE are from cppfunction codes of crane. it's actions present very well. but there is a problem bothering me .i can set the location of frame with a absolute coordinate. but when i make it a object in userlibrary and drag it to the 3d view window,the location of frame will never change according to the drop postion of mouse. so i turn to have a look at cppfunctions of crane, i find there are an OnCreate node and an Ondrag node, but i cannot find similar node in the cppfunctions of BasicTE. so my question is how to keep the positional relation between frame and the new crane object only when draging it, like the crane do. thanks in advance! |
#2
|
||||
|
||||
Hello Oliver,
you find those nodes in the supperclasses of the object. If you want to build your own code for user library objects, add new nodes, rename them, change the type and write therein your code. |
#3
|
|||
|
|||
hi Jörg
thanks for your reply! do you advise me to add trigger node like onCreat from cppfunctions of superclasses obejct under the cppfunctions node of user library object? i donnot know what kind code rules i should follow. it couldn't be better if you can give me an example about your advice. |
#4
|
|||
|
|||
Oliver,
I have a simple solution that may work for you if all you are worried about are the visuals of your object. In the attached model I have a source, 2 queues, 2 cranes, and a sink. Queue3 uses Crane1 to transfer objects to Queue4. In Crane2's general tab I clicked the edit button next to Visuals/Animations and hid all the components of the crane except the Frame, Trolley, and Cable. Then in the OnDraw Trigger of Crane2 I set it's location to be the same as Crane1, but -6 in the y direction. I hope this helps! Cameron |
#5
|
|||
|
|||
hello Cameron
thanks for your reply! the model you submited does meet my requirement partly but not all. the reason why i use the BasicTE object to create my new crane is its actions are more complex than the simple tasksequece can do. and the two trolleys are not always in the same height, their positional relation is collaborative. different actions have different positional relation. the model i have built by using BasicTE is almostly meet my requirement. my problem is when i drag my new crane from user library, i have no codes to keep the positional relation between Frame and hook itsself and then the Frame would go to the Jörg said? |
#6
|
|||
|
|||
Oliver,
If you want the Frame to position itself relative to where you dropped it, but don't want the frame to move after you have placed it you can create an attribute node such as OnCreate or OnDrop in the variables of your object and then toggle the node as FlexScript. Just make sure that you Build Flexscript after you make any changes to the code there. If you want to be able to move the object initially in order to place it correctly you will need to either create an attribute node for OnDrag, and then after the object is placed in its position you can go to the general tab and click on the "Protected" check box so you won't be able to move the object anymore (or delete it from your model). Another option would be to move each of the legs and beams individually through a script window. |
The Following User Says Thank You to Cameron Pluim For This Useful Post: | ||
oliver xie (02-15-2013) |
Thread | Thread Starter | Forum | Replies | Last Post |
Size of crane frame | Yale Zhang | Q&A | 1 | 01-16-2012 11:00 AM |
Crane Frame Size | Martijn van Oostenbrugge | Q&A | 0 | 08-17-2010 07:30 AM |
Frame Animation based on Time | Shanon Loughton | Q&A | 4 | 04-06-2009 09:57 AM |
Crane Move | Sung Kim | Q&A | 2 | 06-05-2008 03:03 PM |
Crane Logic: How to find out what a crane currently is doing? | Tom David | Q&A | 5 | 06-02-2008 11:57 PM |