Author Topic: Block Box  (Read 4225 times)

0 Members and 1 Guest are viewing this topic.

jlandreville

  • Guest
Block Box
« on: August 29, 2005, 12:31:36 PM »
Is it  possible to find the box made by a block just by picking it? I want to do something similar to TEXTBOX.

deegeecees

  • Guest
Block Box
« Reply #1 on: August 29, 2005, 12:35:41 PM »
Do you mean the outer edges of a block? Please elaborate.

jlandreville

  • Guest
Block Box
« Reply #2 on: August 29, 2005, 01:09:45 PM »
The goal is to find the limits of a titleblock just by clicking it. I want to use the lower left and the upper right coordinates for plotting. In fact, I have the lower left point (insert of the block) but I want to find the upper right corner.

deegeecees

  • Guest
Block Box
« Reply #3 on: August 29, 2005, 01:24:24 PM »
Here are some questions to answer so I can get a better idea of what is going on:

1. Will you be using multiple Titleblocks?

2. Will you be inserting them in PS or MS?

3. Will you be scaling them?

jlandreville

  • Guest
Block Box
« Reply #4 on: August 29, 2005, 01:30:43 PM »
1- Yes I have multiple titleblock but I use only one type per drawing

2- Titleblocks are in Paper Space

3- Scale is always 1:1

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Block Box
« Reply #5 on: August 29, 2005, 01:33:09 PM »
You may be able to use the BoundingBox in VBA
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

jlandreville

  • Guest
Block Box
« Reply #6 on: August 29, 2005, 01:40:19 PM »
Thanks Keith!

Do you think they have similar command in Lisp? Right now I began in AutoLisp and I'm too lazy to convert it in VBA   :?

deegeecees

  • Guest
Block Box
« Reply #7 on: August 29, 2005, 01:45:43 PM »
You could use the distance command and get the upper right coords, then use it in your box routine, as it will be constant.

I'm still not sure what you are trying to do.

whdjr

  • Guest
Block Box
« Reply #8 on: August 29, 2005, 01:47:06 PM »
yes they have a vla-getbounding box function:
Quote from: Acad Help
object.GetBoundingBox MinPoint, MaxPoint

Object

All Drawing Objects, AttributeReference
The object or objects this method applies to.

MinPoint

Variant (three-element array of doubles); output-only
The 3D WCS coordinates specifying the minimum point of the object's bounding box.

MaxPoint

Variant (three-element array of doubles); output-only
The 3D WCS coordinates specifying the maximum point of the object's bounding box.

Remarks

The corners are returned in WCS coordinates with the box edges parallel to the WCS X, Y, and Z axes.


jlandreville

  • Guest
Block Box
« Reply #9 on: August 29, 2005, 01:52:38 PM »
Thanks all for your replies. I think that my problem is resolved now.

deegeecees

  • Guest
Block Box
« Reply #10 on: August 29, 2005, 01:55:34 PM »
Quote from: jlandreville
The goal is to find the limits of a titleblock just by clicking it. I want to use the lower left and the upper right coordinates for plotting. In fact, I have the lower left point (insert of the block) but I want to find the upper right corner.


Boy is my face red. Use something like this to get the name of the titleblock:

(SETQ EN1 (ENTSEL"\nSelect entity to display its data: "))
(SETQ EN2 (ENTGET (CAR (ASSOC 2 EN1))))

Then, use boolean to set the already stored values:

(IF (= EN2 "TITLE1")
    (SETQ CORD1 "0,0 12,12")
)

Rudimentary, but I hope this helps.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Block Box
« Reply #11 on: August 29, 2005, 03:03:57 PM »
The coordinates can be found with this

Code: [Select]
(setq ent (car (entsel)))
(setq obj (vlax-ename->vla-object ent)) ; correction made
(vla-getboundingbox obj 'minpoint 'maxpoint)
(setq minpoint (vlax-safearray->list minpoint))
(setq maxpoint (vlax-safearray->list maxpoint))
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.

LE

  • Guest
Block Box
« Reply #12 on: August 29, 2005, 03:25:09 PM »
Quote from: CAB
The coordinates can be found with this

Code: [Select]

(setq obj (vlax-ename->vlax-vla-object ent))


Just a minor typo.....

(vlax-ename->vla-object ent)

Also, there still available the function from vital lisp:

(safearray-value minpoint)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Block Box
« Reply #13 on: August 29, 2005, 03:45:50 PM »
Thanks for the fix...
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.