Using variables to reference features.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using variables to reference features.

    If I reference a feature with a variable:

    Assign/V1={Circle1} (squiggly brackets are required per the help)

    I am supposed to be able to use that variable reference of the feature like this:

    V1.X would be the same as Circle1.X

    Has anyone used this method before and if so, can you reference the hits the same way?

    V1.HIT[1].X
    and so on...

    I keep getting values of Zero(0) when I try to use it.
    Links to my utilities for PCDMIS

  • #2
    It should work, it is a pointer so I don't know how it behaves with mouse hover if that is how you are testing it. Are you testing it by executing the .prg or by querrying it some other way? You could try TUTORELEMENT, that is not a pointer but a copy of a feature it might be friendlier durring debug, but what you are doing should work durring execution but no I have not tried it, I'll give it a shot.
    <internet bumper sticker goes here>

    Comment


    • #3
      OK I just tried this:
      Code:
      CIR1       =FEAT/CIRCLE,RECT,IN,LEAST_SQR
                  THEO/7.6001,9.0766,-25.7127,0,0,1,1.2995
                  ACTL/7.5877,9.0817,-25.7124,0,0,1,1.2581
                  MEAS/CIRCLE,6,WORKPLANE
                  HIT/BASIC,NORMAL,8.2498,9.0766,-25.7127,-1,0,0,8.2166,9.076,-25.7127,USE THEO = YES
                  HIT/BASIC,NORMAL,7.925,9.6393,-25.7127,-0.5,-0.8660254,0,7.9147,9.6194,-25.7123,USE THEO = YES
                  HIT/BASIC,NORMAL,7.2752,9.6393,-25.7127,0.5,-0.8660254,0,7.2808,9.6307,-25.7122,USE THEO = YES
                  HIT/BASIC,NORMAL,6.9504,9.0766,-25.7127,1,0,0,6.9589,9.0761,-25.7123,USE THEO = YES
                  HIT/BASIC,NORMAL,7.2752,8.5139,-25.7127,0.5,0.8660254,0,7.286,8.5295,-25.7123,USE THEO = YES
                  HIT/BASIC,NORMAL,7.925,8.5139,-25.7127,-0.5,0.8660254,0,7.9102,8.5416,-25.7123,USE THEO = YES
                  ENDMEAS/
                  ASSIGN/V1 = {CIR1}
                  COMMENT/OPER,NO,V1.X + ", " + V1.Y + ", " +  V1.Z + ", " +  V1.D
      My comment returned the proper X,Y,Z, and Diameter values. After execution I added a variable after V1 like so:
      Code:
                  ASSIGN/V1 = {CIR1}
                  ASSIGN/V2 = V1.X
      When I mouse hovered over V2 the tool tip read the proper X location of CIR1. Mind you I did that after execution, variables are not truely assigned until execution but I myself have not gotten the hang of that as far as rules go because I swear I have had them work in some instances before execution (during programming). Maybe I'm just crazy but it seems in some cases I can mouse hover for a value and get it but in other cases I can't until execution.
      <internet bumper sticker goes here>

      Comment


      • #4
        Originally posted by craiger_ny View Post
        When I mouse hovered over V2 the tool tip read the proper X location of CIR1. Mind you I did that after execution, variables are not truely assigned until execution but I myself have not gotten the hang of that as far as rules go because I swear I have had them work in some instances before execution (during programming). Maybe I'm just crazy but it seems in some cases I can mouse hover for a value and get it but in other cases I can't until execution.
        No booger boy you're right because I've done it too(Hover and get the calculated value immediately)
        sigpic

        James Mannes

        Comment


        • #5
          Ditto here. If Craig is crazy then I am too.
          When in doubt, post code. A second set of eyes might see something you missed.
          sigpic

          Comment


          • #6
            Originally posted by John Kingston View Post
            Ditto here. If Craig is crazy then I am too.
            Face the fact, guys!

            We're all FN nuts!

            TK
            sigpicHave a homebrew

            Comment


            • #7
              No beer yet....

              I was able to get the .X type of features to show in the hover method of evaluating. The problem was with the hits. I didnt know whether the variable object for the feature would also carry the hits also. I can hover over a hit (circ1.HIT[1]) and see the value, but wanted to use the variable pointer.
              Links to my utilities for PCDMIS

              Comment


              • #8
                I just tried this and it worked:
                Code:
                            ASSIGN/V1 = {CIR1}
                            ASSIGN/V2 = V1.HIT[1].X
                <internet bumper sticker goes here>

                Comment


                • #9
                  Ok, I will give it anohter try. I couldnt get it to work last nite and gave up. Maybe a re-look at the code and I will find my mistake.
                  Thank craig. and everyone else who posted...


                  BEER
                  Links to my utilities for PCDMIS

                  Comment


                  • #10
                    Originally posted by craiger_ny View Post
                    OK I just tried this:
                    Code:
                    CIR1       =FEAT/CIRCLE,RECT,IN,LEAST_SQR
                                THEO/7.6001,9.0766,-25.7127,0,0,1,1.2995
                                ACTL/7.5877,9.0817,-25.7124,0,0,1,1.2581
                                MEAS/CIRCLE,6,WORKPLANE
                                HIT/BASIC,NORMAL,8.2498,9.0766,-25.7127,-1,0,0,8.2166,9.076,-25.7127,USE THEO = YES
                                HIT/BASIC,NORMAL,7.925,9.6393,-25.7127,-0.5,-0.8660254,0,7.9147,9.6194,-25.7123,USE THEO = YES
                                HIT/BASIC,NORMAL,7.2752,9.6393,-25.7127,0.5,-0.8660254,0,7.2808,9.6307,-25.7122,USE THEO = YES
                                HIT/BASIC,NORMAL,6.9504,9.0766,-25.7127,1,0,0,6.9589,9.0761,-25.7123,USE THEO = YES
                                HIT/BASIC,NORMAL,7.2752,8.5139,-25.7127,0.5,0.8660254,0,7.286,8.5295,-25.7123,USE THEO = YES
                                HIT/BASIC,NORMAL,7.925,8.5139,-25.7127,-0.5,0.8660254,0,7.9102,8.5416,-25.7123,USE THEO = YES
                                ENDMEAS/
                                ASSIGN/V1 = {CIR1}
                                COMMENT/OPER,NO,V1.X + ", " + V1.Y + ", " +  V1.Z + ", " +  V1.D
                    My comment returned the proper X,Y,Z, and Diameter values. After execution I added a variable after V1 like so:
                    Code:
                                ASSIGN/V1 = {CIR1}
                                ASSIGN/V2 = V1.X
                    When I mouse hovered over V2 the tool tip read the proper X location of CIR1. Mind you I did that after execution, variables are not truely assigned until execution but I myself have not gotten the hang of that as far as rules go because I swear I have had them work in some instances before execution (during programming). Maybe I'm just crazy but it seems in some cases I can mouse hover for a value and get it but in other cases I can't until execution.
                    Insanity not-with-standing, assignments, at least in V3.7 MR3 do give you the correct value when you create them, at least they do if created from an EXECUTED feature. I am not sure about non-executed features as I don't make assignments until I have executed the feature I am making the assignment from. However, if you then change the feature that the assignment comes from, it does not appear to update the assignment UNLESS you also execute that feature. But then again, I may be lost in an opium dream.
                    sigpic
                    Originally posted by AndersI
                    I've got one from September 2006 (bug ticket) which has finally been fixed in 2013.

                    Comment


                    • #11
                      Originally posted by Matthew D. Hoedeman View Post
                      ..........But then again, I may be lost in an opium dream.
                      Now there's one I haven't had in a while. mmmmmmmmmmm opium, like smoking flowers. Fetch me my hooka Alice

                      `Well, perhaps you haven't found it so yet,' said Alice; `but when you have to turn into a chrysalis--you will some day, you know--and then after that into a butterfly, I should think you'll feel it a little odd, won't you?'

                      `Not a bit,' said the Caterpillar.

                      `Well, perhaps your feelings may be different,' said Alice; `all I know is, it would feel very odd to ME.'

                      `You!' said the Caterpillar contemptuously. `Who are YOU?'
                      <internet bumper sticker goes here>

                      Comment

                      Related Topics

                      Collapse

                      Working...
                      X