Author Topic: insert funness  (Read 4061 times)

0 Members and 1 Guest are viewing this topic.

uncoolperson

  • Guest
insert funness
« on: October 28, 2005, 04:23:56 PM »
I'm trying to build a giant txt file of points to use with grvecs (I've got this much down nice and fine)

however when trying to add a new block to this txt database of sorts i have to explode a few times to get it to line entities... is there an easier (cleaner) way to get a point list from a block?

Thanks Much

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: insert funness
« Reply #1 on: October 28, 2005, 05:34:19 PM »
What have you tried ?
Which drawing program are you using ?

Quote
.. however when trying to add a new block to this txt database ... 


What do you mean by NEW BLOCK ?

PS: can you think of a more suitable Title for this thread ?
I initially passed it over without viewing it because I assumed it was humour
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

uncoolperson

  • Guest
Re: insert funness
« Reply #2 on: October 28, 2005, 05:45:54 PM »
as i said so far all i've tried is a couple sticks of dynamite and a lisp routine

using shapefun to write to the txt file
and drawashape to draw a shape

Code: [Select]
(DEFUN shapefun (/ a ent index points selection pt1 basept id)
  (SETQ basept (GETPOINT "base point:"))
  (SETQ id (GETSTRING "ID:"))
  (SETQ index 0)
  (SETQ selection (SSGET "_W"
(SETQ pt1 (GETPOINT))
(GETCORNER pt1)
'((0 . "LINE"))
  )
  )
  (WHILE (< index (SSLENGTH selection))
    (PROGN (SETQ ent (SSNAME selection index))
   (SETQ points (APPEND points
(LIST
  (LIST id
(LIST (- (CAR (CDR (ASSOC 10 (ENTGET ent))))
(CAR basept)
      )
      (- (CADR (CDR (ASSOC 10 (ENTGET ent))))
(CADR basept)
      )
      0
)
(LIST (- (CAR (CDR (ASSOC 11 (ENTGET ent))))
(CAR basept)
      )
      (- (CADR (CDR (ASSOC 11 (ENTGET ent))))
(CADR basept)
      )
      0
)
  )
)
)
   )
   (SETQ index (+ 1 index))
    )
  )
  (SETQ a (OPEN (FINDFILE "shape.txt") "a"))
  (IF (/= a nil)
    (SETQ points (WRITE-LINE (VL-PRIN1-TO-STRING points) a))
  )
  (SETQ points nil)
  (CLOSE a)
)


(DEFUN drawashape (shape point clr / points pt todraw thesepoints a)
  (SETQ thesepoints
(VL-REMOVE-IF-NOT
   '(LAMBDA (x) (= (CAR x) shape))
   (PROGN (SETQ a (OPEN (FINDFILE "shape.txt") "r"))
  (IF (/= a nil)
    (PROGN (WHILE (/= nil (SETQ pt (READ-LINE a)))
     (SETQ points (APPEND points (READ pt)))
   )
    )
  )
  (CLOSE a)
  points
   )
)
  )
  (FOREACH entry thesepoints
    (SETQ todraw (APPEND todraw
(LIST clr
       (plus point (NTH 1 entry))
       (plus point (NTH 2 entry))
)
)
    )
  )
  (IF todraw
    (GRVECS todraw)
  )
)

I'm using AutoCAD 2005

NEW BLOCK = a block that I haven't yet added to this text file


I think funness works... i'm having fun with what i have so far

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: insert funness
« Reply #3 on: October 28, 2005, 06:14:57 PM »
Please don't think I am picking on you .. you'd know if I was.

Words have meanings.

Do you mean Block, or block Insert Point, or Block Name or .... ?

The code you posted or your comments gives me no real indication ..
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

uncoolperson

  • Guest
Re: insert funness
« Reply #4 on: October 28, 2005, 06:30:41 PM »
Please don't think I am picking on you .. you'd know if I was.

Words have meanings.

Do you mean Block, or block Insert Point, or Block Name or .... ?

The code you posted or your comments gives me no real indication ..


okay, new block = the block, or a block insert.... anything i can pull the points from... i'm trying to create 'phantom' (i think that's right) images of blocks... for my application it makes more sense at the moment...


the points are the end points of the lines that make up the block....

example i have a block that draws a castle.... i wanna grvecs the castle image, so i run shapefun and feed it my castle (after i've blown it to pieces with explode).... i then run (drawashape "castle" (getpoint) 5) and it draws my castle for me...

I just want to get past having to explode stuff to get the endpoints of all the lines that make up a block...(cause i'm lazy, and curious)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: insert funness
« Reply #5 on: October 28, 2005, 06:46:38 PM »
so you dont want the block, you want the lines in the block ? yes ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: insert funness
« Reply #6 on: October 28, 2005, 06:47:49 PM »
I'm having trouble with your terminology ?
Quote
example i have a block that draws a castle
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

uncoolperson

  • Guest
Re: insert funness
« Reply #7 on: October 28, 2005, 06:58:23 PM »
I'm having trouble with your terminology ?
Quote
example i have a block that draws a castle

example i have a block that is a castle ( I don't really, but a castle seemed fun)

It's funny, the only language i speak is english, and i do that very poorly...

yeah i want the lines and arcs (when i get that adventurous) and all the fun simple entities that are in the block....I know exploding is a nice easy way to do it, i'm just wondering if there is another way (more funner?, creating more funness with inserts/blocks (those things))

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: insert funness
« Reply #8 on: October 28, 2005, 07:02:30 PM »
If it's just fun you are after, I'll leave you to someone better suited to provide it.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Dent Cermak

  • Guest
Re: insert funness
« Reply #9 on: October 28, 2005, 08:52:45 PM »
Check the "Explode" block in the insert dialog box? (older version ls insert:  - "block name") That way it explodes the block on insertion and you don't have to do anything else?

JohnK

  • Administrator
  • Seagull
  • Posts: 10659
Re: insert funness
« Reply #10 on: October 28, 2005, 10:00:43 PM »
I'm having a hard time figuring out your coding style. Some extra stuff in some areas, some areas use a very minimal approach, some functions look to be thought thru for speed and error checking while other areas are "left open for a crash"....hummm very interesting. But anywasy, have you looked into MP's ghosting procedures? You can ghost the block to insert while the user picks a point then when they do, you can insert the real deal then explode the thing.

Would that be fun?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

uncoolperson

  • Guest
Re: insert funness
« Reply #11 on: October 29, 2005, 02:26:17 AM »
what can i say, i write the way i think (randomly thought through, and never consistant)

well in the lisp world i sorta never put too much thought into error checking, or generally prettiness... still coming to terms with the parenthesis...(where's my curly brace!) so my coding style is sorta a 'hey this works now and tomorrow I'll figure the rest out', and then 'hey i can add this and make it do this' before i make the first set of stupidity better. (that's why I'm going to school... learn the right way)

as for mp's ghosting procedures, haven't heard of them... but I'll look around. just trying to learn some magic.

the problem originated with a co-worker that is creating blocks outside of my library that are inserted as a temp then removed and the real block is inserted... and I'm not a fan of multiple copies (say 3+) of my blocks floating around.... then it got out of hand and i started wondering how i may dig deeper in the dxf....I'm still just dxf and basic lisp like, haven't really touched the visual lisp stuff yet, working myself up to that.

"fun is fun"

(the spell check here doesn't like "dxf")

JohnK

  • Administrator
  • Seagull
  • Posts: 10659
Re: insert funness
« Reply #12 on: October 29, 2005, 09:03:38 AM »
Here is one of his ghosting threads. Very cool stuff.
http://www.theswamp.org/forum/index.php?topic=7089.0

Give that a whirl. There is another thread on ghosting in the "show your stuff" forum.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

uncoolperson

  • Guest
Re: insert funness
« Reply #13 on: October 29, 2005, 01:43:34 PM »
So that's how it should've looked...