Author Topic: Algorithm  (Read 344 times)

0 Members and 1 Guest are viewing this topic.

badjo_5

  • Mosquito
  • Posts: 5
Algorithm
« on: January 30, 2019, 03:11:15 PM »
Maybe this is not the right place to for this, but here I go:
classic point manager for insertig survey points from file(s) to dwg.
Any of these point's CAN have code and this code is a representation for a topographyc symbol.

I can hardcode (already did for small amount of codes) add-in that code "a1" represents block 'connector_a', code "a2" represents block 'conector_w', and so on.
Question is how to write that more 'dinamicaly', so every user can have a different code list, or every job can have different code list depends on type of job.
I have loaded points from file to grid, than I must load code list from file (or registry, or .....), and what now? Mutiple if's or switch's are a bad idea I think, because there is no predefined code list.
Second idea: replace code with block name and then simply insert block if code is not null or empty... This is not much different from first.
Or maybe Dictionary or NameValueCollection?


MickD

  • Gator
  • Posts: 3289
  • (x-in)->[process]->(y-out)
Re: Algorithm
« Reply #1 on: January 30, 2019, 03:37:53 PM »
I'm not quite sure I understand but I think you're saying that you have a file from somewhere listing points with a code for type of point.
The type code of the point determines the type of block you want to insert in the drawing.
But, every user may have different names for type codes (block names do not match type codes).

If this is what you are saying then I'd create a text file with a simple dictionary that maps type codes to block names that the user can edit to suit there standard block library.
Something like:

a1, connector_a
a2, connector_w
etc

Read this into a dictionary and you have your mappings.
hth
Debugging:
Being the detective in a crime movie where you're also the murderer.

“Someone's sitting in the shade today because someone planted a tree a long time ago.”
- Warren Buffet