Author Topic: inserted block to vla object  (Read 2085 times)

0 Members and 1 Guest are viewing this topic.

hmspe

  • Bull Frog
  • Posts: 362
inserted block to vla object
« on: July 22, 2006, 08:53:39 PM »
I've fought with this for several hours and I'm getting nowhere.  Not finding any examples or help entries that help.

I'm playing with a routine that will automatically align a block (which shows the number of wires in a conduit) when the block is inserted on top of a a line, arc, circle, etc.  The line option was easy, as was finding the arc's tangent angle at the block's insertion point, but for arcs, etc., I'm wanting to also automatically shift the block toward the center point of the arc to make the appearance more balanced.  To that end I'm trying to use Jurg Menzi's VxGetBlockInters function, available in the Free Stuff section at http://www.menziengineering.ch/, which returns all intersection points between a Block and an object.  The function expects a Block object and an Object, both being vla-objects.

I'm using the following to insert the block:

  (setq symbol (strcase "t3_2wn4w"))
  (setq ds (getvar "dimscale"))
  (prompt "\nSelect insertion point...  ")
  (command "_insert" symbol "PS" ds pause ds ds pause)
  (setq ent_ins (entget (entlast)))

What I'm not finding is a way to convert ent_ins to a block vla-object that VxGetBlockInters will accept.  If anyone can point me in the right direction I'd appreciate it.

Martin
"Science is the belief in the ignorance of experts." - Richard Feynman

Chuck Gabriel

  • Guest
Re: inserted block to vla object
« Reply #1 on: July 22, 2006, 09:03:14 PM »
(vlax-ename->vla-object (entlast))

hmspe

  • Bull Frog
  • Posts: 362
Re: inserted block to vla object
« Reply #2 on: July 22, 2006, 10:39:39 PM »
Thanks for the reply.  Between posts I did a bit more looking.  I didn't have much luck with

    (vlax-ename->vla-object (entlast))

but I do have things working with

    (setq block_ename (MakeX (ssname (ssget "_L") 0)))

"Science is the belief in the ignorance of experts." - Richard Feynman

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: inserted block to vla object
« Reply #3 on: July 22, 2006, 10:49:38 PM »
The code Chuck posted should work for you without making a selection set to manipulate.

What is  (MakeX ... ?
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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: inserted block to vla object
« Reply #4 on: July 23, 2006, 12:12:18 AM »
Is it possible the entlast function name was used as a variable name somewhere in the code preceding? Also, if the attempt to make the block insert fails there is no telling what entlast returns.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

hmspe

  • Bull Frog
  • Posts: 362
Re: inserted block to vla object
« Reply #5 on: July 23, 2006, 12:33:41 AM »
I did a search of local lisp files and found this in my utilities file:

  (defun MakeX (entname)
    (vlax-ename->vla-object entname)
  )

As should be obvious, I almost know enough about Visual Lisp to be dangerous.  It turns out the main problem was that I had a couple of variables out of order in one of the function calls. 

Thanks to all who posted.
"Science is the belief in the ignorance of experts." - Richard Feynman