Grasshopper

algorithmic modeling for Rhino

Hi everyone,

I'm striving hart to make my first GH componet to work. It's about connecting Grasshopper with structural engineering FEM software Strand7 through it's API. I'm using Visual Basic for this job... and GHA assembly wizard of course. At this stage I want to import some points from GH as nodes into Strand7. I wrote some code (at writing it I help myself with example that came with API)...and it somehow works, but not completely... Strand7 window opens, but insead of 169 nodes, just first one is created...it seems that For loop is not working... can samebody check it (I attached pdf with explanation what I did) and posibly find out what is wrong...

Just loop part is below:

            For i = 1 To noP
                onePoint = points.Item(i - 1)
                XYZ(0) = onePoint.X
                XYZ(1) = onePoint.Y
                XYZ(2) = onePoint.Z
                Console.WriteLine(XYZ)
                iErr1 = St7SetNodeXYZ(1, i, XYZ(0))
                Errtxt = Errtxt & iErr1
                Console.WriteLine(Errtxt)
                Exit For


            Next

Any other suggestion is also welcome.

Regards,

Damir

Views: 487

Attachments:

Replies to This Discussion

            For i = 1 To noP
                onePoint = points.Item(i - 1)
                XYZ(0) = onePoint.X
                XYZ(1) = onePoint.Y
                XYZ(2) = onePoint.Z
                Console.WriteLine(XYZ)
                iErr1 = St7SetNodeXYZ(1, i, XYZ(0))
                Errtxt = Errtxt & iErr1
                Console.WriteLine(Errtxt)
                Exit For


            Next

The "Exit For" is the cause of your problem. This command is util inside a "if...else", but here, you only need next. When execution reaches next, the loop is repeated until i reaches noP, then, execution continues after the For ... next method.

Daniel,

Woohooo, it works...thany you very much for fast reply.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service