Author Topic: entmake external insert  (Read 2352 times)

0 Members and 1 Guest are viewing this topic.

daron

  • Guest
entmake external insert
« on: June 30, 2005, 11:07:41 AM »
Using entmake, can you insert a predefined wblock? I thought it was possible and I've used group codes 0, 2 and 10, yet I still can't get it to work.
Here's a sample code pretty close to what I have. I'm guessing the problem is with the external block, but I don't know how to overcome that. Any help, please? Thanks.
Code: [Select]

(entmake
     (list (cons 0 "INSERT")
           (cons 2 (strcat "c:\\DWG\\zBlocks\\" blockname ".dwg"))
           (cons 10 (pointListCreationFunction))
     )
)


I'm sure it's the external block, because I tried it with an existing block and it worked.

How do you insert an external dwg with entmake?

What are the dxf group codes that allow for rotation angle?

daron

  • Guest
entmake external insert
« Reply #1 on: June 30, 2005, 11:29:49 AM »
50. Nevermind. I wasn't looking in the right place for it. Now, how am I going to figure the angle based on start and end points along a selected line? That's a self ponerous note, but you can feel free to help.

Amsterdammed

  • Guest
entmake external insert
« Reply #2 on: July 02, 2005, 03:58:50 AM »
Code: [Select]

(setq en (entsel "\nget line")
      el (entget (car en))
      pt1 (cdr(assoc 10 el))
      pt2 (cdr (assoc 11 el))
      rad (angle pt1 pt2)
      deg (/(* 180 rad) pi) )


There is no safety net in this code, so you must select a line.

Rad is the angle in radiant, deg in degrees.

Bernd

tcdan

  • Guest
entmake external insert
« Reply #3 on: July 02, 2005, 08:23:28 PM »
Wow, LISP is exciting stuff. . . so Daron, could you explain in dumbie language what your function does (how it would be applied practically)?

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
entmake external insert
« Reply #4 on: July 02, 2005, 10:38:02 PM »
Daron, I thought you could do that with (entmake), too. But after trying a number of different things, I cannot get it to work.

However, turning to our relatively new friend, ActiveX, we CAN do this:
Code: [Select]

(vlax-invoke (get_space) 'insertblock '(0.0 0.0 0.0) (findfile "car.dwg") 1.0 1.0 1.0 0.0)

where (get_space) is just a small helper function to get the current space and I used the (findfile "car.dwg") as I knew it existed in my support path.

tcdan, this would be used to insert a block that is not yet defined in the drawing and is probably too big to try defining the entire thing with code.

daron

  • Guest
entmake external insert
« Reply #5 on: July 02, 2005, 11:27:56 PM »
entmake also allows you to do many things, including avoiding using "command" which can have many adverse effects depending on the scope of your work. There are some test we performed back in the early days of the swamp.
Here's one.
A lengthy one, but this.
And then, this one is pretty helpful.

Jeff, thanks for the answer to the hard part of the puzzle. I may use ActiveX, but my company might be switching to a cheaper cad alternative, so I was trying to stay away from it. I might just give it a shot and hope for the best, though.

Bernd, Thanks for the code.