Author Topic: How many ways can you create a LINE  (Read 8617 times)

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: How many ways can you create a LINE
« Reply #15 on: October 04, 2005, 03:41:16 PM »
Wow Bob,
 I expected some reaction from those who find it inappropriate somehow using 'Command'
 in a lisp, but this was unexpected. If you've been lisping more than a month or two you
 should immediately recognize a code snip-it from a functioning routine.
 
 If you drop that code into a new window in VLIDE and run the format function it will tell you
 if there are any unmatched parentheses. :kewl:
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Bob Wahr

  • Guest
Re: How many ways can you create a LINE
« Reply #16 on: October 04, 2005, 03:53:03 PM »
I recognized it as a snippet and was just messing around although I haven't lisped for somewhere in the ballpark of 15 years.

Peter Jamtgaard

  • Guest
Re: How many ways can you create a LINE
« Reply #17 on: October 04, 2005, 05:38:55 PM »
How about.

Peter

Code: [Select]
(defun C:MakeLine ()
  (vla-addLine (vla-get-block
                (vla-get-activelayout
                 (vla-get-activedocument
                  (vlax-get-acad-object)
                 )
                )
               )
   (vlax-3d-point (getpoint "\nPick First Point: "))
   (vlax-3d-point (getpoint "\nPick Second Point: "))
  )

)

Bob Wahr

  • Guest
Re: How many ways can you create a LINE
« Reply #18 on: October 04, 2005, 05:54:52 PM »
Code: [Select]
(vl-vbarun "lineit")
Where exists also currently loaded
Code: [Select]
Option Explicit
Sub LineIt()
Dim varStPt As Variant
Dim varEnPt As Variant
Dim booQuit As Boolean
On Error GoTo FixDaBustedness
  varStPt = ThisDrawing.Utility.GetPoint(, vbCr & "First Point: ")
  Do While Not booQuit
    varEnPt = ThisDrawing.Utility.GetPoint(, vbCr & "Next Point: ")
    If ThisDrawing.ActiveSpace = acModelSpace Then
      ThisDrawing.ModelSpace.AddLine varStPt, varEnPt
    Else
      ThisDrawing.PaperSpace.AddLine varStPt, varEnPt
    End If
    varStPt = varEnPt
  Loop
GwanNowHeah:
  Exit Sub
FixDaBustedness:
  Select Case Err.Number
    Case -2145320928
      booQuit = True 'I know it means nothing
      GoTo GwanNowHeah
    Case Else
      Debug.Print Err.Number
      MsgBox "To get from the left to the right, HUNH", vbCritical, "Why did the chicken cross the road?"
    End Select
End Sub
:evil:

JohnK

  • Administrator
  • Seagull
  • Posts: 10646
Re: How many ways can you create a LINE
« Reply #19 on: October 04, 2005, 08:25:24 PM »
Everyones code, but MPs, is nice. :kewl:

Bob, i like reading your code. Its fun.

But couldnt you do something like this?

Insead of this:
Code: [Select]
If ThisDrawing.ActiveSpace = acModelSpace Then
  ThisDrawing.ModelSpace.AddLine varStPt, varEnPt
Else
  ThisDrawing.PaperSpace.AddLine varStPt, varEnPt
End If
Do this:
Code: [Select]
If ThisDrawing.ActiveSpace = acModelSpace Then
  space = ThisDrawing.ModelSpace
Else
  space = ThisDrawing.PaperSpace
End If

space.AddLine varStPt, varEnPt
 

To make it more readable? (Or am i just wacked?...Nevermind, dont answer that.)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How many ways can you create a LINE
« Reply #20 on: October 04, 2005, 08:47:35 PM »
Everyones code, but MPs, is nice. :kewl:

Speak english man.

Everyone's code except MP's is nice.

:P
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: How many ways can you create a LINE
« Reply #21 on: October 04, 2005, 08:50:42 PM »
Se7en,  I would tend to agree with you that it does make the code a bit more readable, and given the nature of the many things you would do in a program that requires the active space be known, it would likely be completed in a previous step ... however for the overhead of a simple program, it would save memory requirements by not creating a variable.

Often times people create a variable that is going to be used only once .. while it may make the program more readily readable, it also makes the program require more overhead, particularly if the same thing is repeated multiple times in a program.
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

JohnK

  • Administrator
  • Seagull
  • Posts: 10646
Re: How many ways can you create a LINE
« Reply #22 on: October 04, 2005, 09:53:14 PM »
Whoa, Variables, Memory, overhead?! i just wanted to pick on Bob. *Bleah* :P

(I wanted to pick on MP too, but he had to get all "Old english teacher dude" on me.)

Darn it Jim, I want a recount!!

TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: How many ways can you create a LINE
« Reply #23 on: October 04, 2005, 10:04:18 PM »
Se7en ... Now that you mention it, I have a TSR that I made many years ago called WHOA and it does indeed slow down a computer ... what do I need that for you might ask? Well... many years ago, when the speed of computer CPUs were outpacing the need for them by 5 to 1 there were many programs that when run on a speed demon of a system (for example a P100) that was designed to be operated on a 486Dx33, the thing would go so fast that you would have problem with the output, and the program was useless ... so, to make these programs work at the desired speed, we could run WHOA once, twice or 10 times (depending upon how slow we needed the system to go) and then run our nice slow program ... can you imagine intentionally telling the processor to skip every third cycle, or every other cycle ... or rather devote only 1 cycle per 10 to the current application .... lotta fun that one ... WHOA ... still cracks me up ...
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

JohnK

  • Administrator
  • Seagull
  • Posts: 10646
Re: How many ways can you create a LINE
« Reply #24 on: October 04, 2005, 10:17:01 PM »
*blink* A "P100"!? ...Im using a P4! (I didnt even see the p5 comeout?!)
:ugly:
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: How many ways can you create a LINE
« Reply #25 on: October 04, 2005, 10:40:26 PM »
don't blink too often, you might miss the next generation ... the awesome P166MMX (you do remember MMX ... what the heck ever happened to that?)
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

SMadsen

  • Guest
Re: How many ways can you create a LINE
« Reply #26 on: October 05, 2005, 04:54:29 AM »
Here is yet a way to create a LINE


LE

  • Guest
Re: How many ways can you create a LINE
« Reply #27 on: October 05, 2005, 09:22:25 AM »
Here is yet a way to create a LINE



Yes!

I still use the parallel glider, some times.... so another would be:

Parallel rule
T rule
Universal rule
...

Maverick®

  • Seagull
  • Posts: 14778
Re: How many ways can you create a LINE
« Reply #28 on: October 05, 2005, 11:20:50 AM »
  *Thinking how Se7en could create a line*

http://www.theswamp.org/screens/Maverick/flatline.jpg

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How many ways can you create a LINE
« Reply #29 on: October 05, 2005, 12:36:24 PM »
Looks like my lines until I've had my coffee.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst