Author Topic: Get Block  (Read 21442 times)

0 Members and 2 Guests are viewing this topic.

Joker

  • Guest
Re: Get Block
« Reply #15 on: March 14, 2006, 06:16:59 PM »
I did a search and found out what pseudo code is.  If I understand it correctly, Pseudo Code is a shopping list of tasks that the program needs to do in order to get what you want.

Here is my pseudo code:
Code: [Select]
User picks block to export
The block maintains the name
Export the block to new location
Maintain insert point
Explode the block
Collect all new entities in a list
Set to layer 0
Maintain colors the block provides
Set linetype to By Block
Insert Block to 0,0
Purge
Save
close
End of pseudo code

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Get Block
« Reply #16 on: March 14, 2006, 06:30:21 PM »
You are correct about the term pseudo code.  We are giving you the pseudo code so you can do some research to learn how to do it.  Take what we give you and run with it, and if you have questions, post back and someone will answer it for you.  You stated that you want to learn with this one, so this is you chance to get started, or do you need a push to help you out?
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Joker

  • Guest
Re: Get Block
« Reply #17 on: March 14, 2006, 06:44:03 PM »
You are correct about the term pseudo code.  We are giving you the pseudo code so you can do some research to learn how to do it.  Take what we give you and run with it, and if you have questions, post back and someone will answer it for you.  You stated that you want to learn with this one, so this is you chance to get started, or do you need a push to help you out?

Could you please give me a push in the right direction?  Once I get pushed in the right direction and start to figure it out.  I will be back with questions and so on.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Get Block
« Reply #18 on: March 14, 2006, 06:51:15 PM »
Could you please give me a push in the right direction?  Once I get pushed in the right direction and start to figure it out.  I will be back with questions and so on.
My pleasure.

First off I would select the block to exported from the screen.  Either use "ssget" with a filter list for only blocks, or use "entsel" and then make sure you have a block.  For both the filter list, and to make sure you have a block, you will need to look at the dxf code.  You can access this from the help files.  Once you select the object, you can get the entity data of the object with "entget".  From there you can get the block name (dxf code 2).  This should be enough to get you started.  Have fun.  You can also search for little tidbits of help if no one is on to help you out.

Have fun!
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

nivuahc

  • Guest
Re: Get Block
« Reply #19 on: March 14, 2006, 07:13:06 PM »
Code: [Select]
User picks block to export
The block maintains the name
Export the block to new location
Maintain insert point

I would start there and build on it. That's just me. Too much information tends to overwhelm. YMMV.

Jim Yadon

  • Guest
Re: Get Block
« Reply #20 on: March 14, 2006, 07:25:23 PM »
To start with, my LISP skills are limited. So please just take this as an observation.

Did you all consider that some folks may have entities already existing at or in the vicinity of 0,0? You could avoid the potential hazards of picking up extra 'passengers' when the block gets re-written.

Code: [Select]
User picks the block to export.
Pull the object from the selection set to the clip board.
Open a new drawing.
Paste to drawing.
Acquire insertion point info.
Explode.
Clean.
Purge.
Rewrite to a new file maintaining insertion point info.
Close new session.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Get Block
« Reply #21 on: March 14, 2006, 08:24:58 PM »
Rather than insert & explode, just set an Undo Begin, get the block name from a selection, get the block object from the block table, edit the block objects direct for color, linetype & layer, then Wblock out the block....bam, yer done. Then set Undo End then Undo Back.

Just my $0.02

Jim Yadon

  • Guest
Re: Get Block
« Reply #22 on: March 14, 2006, 09:03:59 PM »
Rather than insert & explode, just set an Undo Begin, get the block name from a selection, get the block object from the block table, edit the block objects direct for color, linetype & layer, then Wblock out the block....bam, yer done. Then set Undo End then Undo Back.

Just my $0.02

Out of curiousity, why would you put the UNDO code in there? I don't see why you'd need it at that point.

Jim Yadon

  • Guest
Re: Get Block
« Reply #23 on: March 14, 2006, 09:18:32 PM »
Because the Block table has been modified, and you dont want that change to persist.

That's why I am asking. It would seem to me that if you were going to the trouble of stripping a block down to the bones (aka zero layering it) to write it to file for later use, that you'd want those changes to persist in the drawing that it's already existing/being used in. Hence, ' why the UDO? '. Make sense?

Jim Yadon

  • Guest
Re: Get Block
« Reply #24 on: March 14, 2006, 09:34:11 PM »
Sorry. I got so hung up on trying to understand the undo that your notes didn't sink in.  :ugly:

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Get Block
« Reply #25 on: March 14, 2006, 10:19:49 PM »
Jay,
I wouldn't use the Undo in my rendition of this for the very reasons you pointed out. But as Kerry also pointed out, that's pretty much what the OP requested.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Get Block
« Reply #26 on: March 14, 2006, 11:36:30 PM »
Jay,
I wouldn't use the Undo in my rendition of this for the very reasons you pointed out. But as Kerry also pointed out, that's pretty much what the OP requested.

That is the way I understood the request but I'm nit sure that is the desired result. joker will need to clarify that point for us.
I personally would keep the changes in the parent drawing.
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Get Block
« Reply #27 on: March 14, 2006, 11:40:35 PM »
Rather than insert & explode, just set an Undo Begin, get the block name from a selection, get the block object from the block table, edit the block objects direct for color, linetype & layer, then Wblock out the block....bam, yer done. Then set Undo End then Undo Back.

Just my $0.02
When you say "wblock out the block" are you actually saying "wblock out the insert"? Just want to have it clear in my mind.
If you are wblocking out the insert, what if it is scaled and/or rotated?
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Get Block
« Reply #28 on: March 15, 2006, 12:28:26 AM »
I believe Jeff meant "duplicate the definition", which is the way I also read the request.
Kerry could I trouble you to clarify that?
By definition you mean the 'Block definition in the block table' and not the Insert.
By duplicate you mean create a new definition in the block table?
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Get Block
« Reply #29 on: March 15, 2006, 12:44:07 AM »
While the smoke is clearing, one more step.
If the insert is scaled and or rotated the we should not use that object to duplicate.
So to wblock you can not use a 'Block Definition', you need an Insert?
Therefore we are back to Insert & Explode?
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.