Author Topic: New Project Step 1 Linetypes  (Read 16050 times)

0 Members and 2 Guests are viewing this topic.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4073
New Project Step 1 Linetypes
« on: July 05, 2005, 11:35:49 AM »
Ok, we are ready to move ahead and code something useful.  I am thinking of a project that draws some lines, making sure that the proper layer is being used, and setting/changing the lineweights as needed to accopmplish this through a dialog box and command line.  We will also need some error checking to make sure the user can't crash the whole system.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4073
New Project Step 1 Linetypes
« Reply #1 on: July 05, 2005, 11:41:27 AM »
My first thoughts before we code anything are organizational thoughts:

Quote
1-What linetypes need to be loaded?

for now we will use Dash and Hidden to get started
Quote
2-What layers, if any, need to be created/set current?

I think we need 2 layers to go with our 2 linetypes.  White and yellow on a black background works well
Quote
3-Ltscale / PsLtscale issues

I think we need to work at a scale of 1 for now b/c part of us are Metric, and the rest are imperial.  Starting with 1 makes it easier for concepts to be conveyed.  This also gives us some areas to set system var like Psltscale, Dimscale, and Ltscale
Quote
4-Do you want this to be dialog driven or command line driven?
Lets code for both

And finally, what does all this do?  Lets draw a pline on a layer that uses the correct linetype, lineweight, and pline width.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4073
New Project Step 1 Linetypes
« Reply #2 on: July 05, 2005, 12:12:48 PM »
Any ideas on how to get started?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
New Project Step 1 Linetypes
« Reply #3 on: July 05, 2005, 01:14:33 PM »
When I get some time, I'll put something together
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4073
New Project Step 1 Linetypes
« Reply #4 on: July 06, 2005, 06:26:13 PM »
This is for everyone that wanted to learn VBA.  Im looking for a discussion on what we should do to get started, and what needs to be done to accomplish the task.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

daron

  • Guest
New Project Step 1 Linetypes
« Reply #5 on: July 07, 2005, 07:48:24 AM »
I believe you already have something in mind, don't you? Why don't you just start it off. I'd think most people wouldn't know where to begin since we're mostly starting off at the edge of the pond and are reluctant to jump in with both feet.

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
New Project Step 1 Linetypes
« Reply #6 on: July 07, 2005, 08:13:21 AM »
Do you want us to pseudo code something, and then expand it from there?

Is that what you want us to do?
Thanks for explaining the word "many" to me, it means a lot.

Birdy

  • Guest
New Project Step 1 Linetypes
« Reply #7 on: July 07, 2005, 08:46:50 AM »
Quote from: daron
... most people wouldn't know where to begin since we're mostly starting off at the edge of the pond and are reluctant to jump in with both feet.


<raising hand>....uuuhhh... that'd be me, for one.
    
CmdrDuh, your suggestions sound good to me.  Just something to draw some lines.  Simple, sweet, easy...

whdjr

  • Guest
New Project Step 1 Linetypes
« Reply #8 on: July 07, 2005, 09:39:06 AM »
My thoughts are that we need to outline what it is we want our code to do, then we need to figure out what it affects as far as system variables and other settings.  Then we can start coding. :)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4073
New Project Step 1 Linetypes
« Reply #9 on: July 08, 2005, 11:13:40 AM »
Quote from: whdjr
My thoughts are that we need to outline what it is we want our code to do, then we need to figure out what it affects as far as system variables and other settings.  Then we can start coding. :)

Exactly!!!
So, what do we want to do?
I have a list of reqirements for a simple project that we can work on.  Here
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4073
New Project Step 1 Linetypes
« Reply #10 on: July 08, 2005, 11:47:43 AM »
Lets make small modules that we can test, then combine them all into a larger program.  Lets start by loading some line types.  Dashed and Hidden to get started.

I'll start us off
Code: [Select]

Public Sub LLine()

End Sub

For those that are coding (read following) along, put this in the ThisDrawing Module of a new project. (For anyone needing help getting a new project started or help locating this, PM me)

What goes between the first and last line I posted?  I'll give you a hint.  We are going to use a method inside of ThisDrawing to load our linetypes, so ......
Code: [Select]

Public Sub LLine()
ThisDrawing.
End Sub

If you type that in, and hit the DOT (period) after ThisDrawing, you will get a list of methods we can access.  Lets see who can figure out what goes next.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

daron

  • Guest
New Project Step 1 Linetypes
« Reply #11 on: July 08, 2005, 12:03:36 PM »
Somehow, I'm thinking this
Code: [Select]
ThisDrawing.Linetypes.Load=("Hidden, Dashed" "acad.lin")
but I'm not getting it quite right. What am I doing wrong?

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4073
New Project Step 1 Linetypes
« Reply #12 on: July 08, 2005, 12:12:54 PM »
Quote from: daron
Somehow, I'm thinking this
Code: [Select]
ThisDrawing.Linetypes.Load=("Hidden, Dashed" "acad.lin")
but I'm not getting it quite right. What am I doing wrong?

Your very close!  Enter stage right, Online Help.  Now I hate online help as much as the next guy, I prefer books, so i can break the binding in all the right spots.  KEY FEATURE is if you highlight what you want to search on and hit F1, it loads the help file.  So  highlight Linetypes.Load and hit F1

It is going to give you the definition, and to the right is See Example.  Click that.  it is going to give you and example similiar to this
Code: [Select]
Sub Example_Load()
    ' This example attempts to load the linetype "HIDDEN" from
    ' the acad.lin file. If the linetype already exists, then
    ' a message is displayed.
   
    Dim linetypeName As String
    linetypeName = "HIDDEN"
   
    ' Load "HIDDEN" line type from acad.lin file
    On Error Resume Next    ' trap any load errors
    ThisDrawing.Linetypes.Load linetypeName, "acad.lin"
   
    ' If the name already exists, then notify user
    If Err.Description = "Duplicate record name" Then
        MsgBox "A line type named '" & linetypeName & "' already exists.", , "Load Example"
    End If
   
End Sub
 
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4073
New Project Step 1 Linetypes
« Reply #13 on: July 08, 2005, 12:19:52 PM »
Something very important about the example is you DO NOT HAVE TO FOLLOW IT exactly.

Notice it took 3 lines to load a linetype in that example
Code: [Select]
Dim linetypeName As String
linetypeName = "HIDDEN"
ThisDrawing.Linetypes.Load linetypeName, "acad.lin"


The first line is declaring a variable as type String.  Our name of the linetype is a string (Duh)
Second line sets the string to a value.
And finally, third line does the work.

It could have been done with one line-
Code: [Select]
ThisDrawing.Linetypes.Load "HIDDEN", "ACAD.LIN"
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

daron

  • Guest
New Project Step 1 Linetypes
« Reply #14 on: July 08, 2005, 12:21:48 PM »
Heh. I did that for Linetypes property, but I do see where I was going wrong. No parens.