hexagon logo

Passing Variables / Subroutine for PC-DMIS 2011 MR1

I'm new to subroutine and stuffs:

Managed to perform and callsub the subroutines out without problems but how do i exactly extract the data from the external program? (subroutine is stored in another external program, not within the main program itself). Don't really understand how the "passing variables" work, tried with all I can but never got it to work. and we can only extract the feature? not the dimension call-out for the feature? are they done in the main program, or in the external subroutine program?

Would love to hear solutions and insights from you guys, appreciate it much. Thank you!
  • i tried "attaching" the external file program inside, calling out the dimension, but the dimension remained unchanged like as if it is not getting the data from the subroutine executed.
  • You would need to call the variables from within the subroutine itself and pass them to your main program.
    You can only do that when the subroutine is executing so you call should be in the subroutine not the main program.
  • any simple codes to illustrate how the "passing the variables" work? like, if i have features and dimension call-out in the subroutine, what and how do i define them, and later on passing it to the main program -> and show the results in the main program~
  • you don't really need to pass the info back & forth. You can use the callsub command label to reference the feature inside the subroutine.
    CS = CALLSUB (not real sure of the command).
    Use the feature in the main program by CS:FeatureName (where FeatureName is the name of the feature in the subroutine).

    The "CS:" tells pcdmis to find the command which is "CS" and use the referenced command.

    Just replace CS with your command label and fill in the correct feature name.
    You may need to manually type the name in the dimension.
  • you don't really need to pass the info back & forth. You can use the callsub command label to reference the feature inside the subroutine.
    CS = CALLSUB (not real sure of the command).
    Use the feature in the main program by CS:FeatureName (where FeatureName is the name of the feature in the subroutine).

    The "CS:" tells pcdmis to find the command which is "CS" and use the referenced command.

    Just replace CS with your command label and fill in the correct feature name.
    You may need to manually type the name in the dimension.



    also make sure that you use the curley brackets "{}" when calling/passing features otherwise it won't work
  • This is old but.... This is awesome! I was in a 2 day long CODE battle when a google search turned this up. I can finally move on. You the ROCK !

    This led me to Pcdmis help file section: "IDs for Feature within Subroutines, Basic Scripts, or External Routines"

    I have 2 operations,

    op1: Export feature objects via an array to a Subroutine. Sub loops thru array and writes a line string containing feature data to a text file. 1 or 1000 features builds lines of data accordingly.

    op2: Open text file and loop thru every line in the file. Build generic feature on each loop plugging in data. Dimension sub features in main via "<Call Sub ID>:<FeatID>" and since it's a loop "<Call Sub ID>:<FeatID [n]>".

    No more typing out every feature in both OPs for every part! And no I can't use any other option in case your gear is turning.

  • This led me to Pcdmis help file section: "IDs for Feature within Subroutines, Basic Scripts, or External Routines"


    Imagine how much more well informed and efficient we would all be if we read the help file any time we used something new in pc-dmis. I'm getting better about it, but still guilty of not educating myself before plunging in.

    I wasn't aware of CS: either, so I'm really glad you bumped it!


  • Imagine how much more well informed and efficient we would all be if we read the help file any time we used something new in pc-dmis. I'm getting better about it, but still guilty of not educating myself before plunging in.

    I wasn't aware of CS: either, so I'm really glad you bumped it!


    I read some CS Lewis (Chronicles of Narnia dude) material and it has motivated me and explore what I thought I had under my belt.


  • I read some CS Lewis material and it has motivated me and explore what I thought I had under my belt.


    We would all be the wiser to read posts from SA Barber. He knows from whereof he speaks!
    For everything else? There's Lewis Carroll and C. Wright Mills Sunglasses