Jump to content

Insert Part Description to be read by an Outside Program.


dblclkmatt

Recommended Posts

I don't know really where to post this questions.

 

My job frequently has me draw up parts and then export them out to a nesting program called ProNest. Each part has a Build-Material description attached, which contains the name, quantity, material, and remarks.

 

Like this:

Snap1.jpg

 

It obviously works as is, but I have to click into each line item, and then delete/replace the previous entry, after I have already inserted it.

 

What I want to make happen:

I'd like to insert a block and that have a series of prompts me for to enter.

For example:

Type in the value of the Part Number and the Quantity.

And the Material, Thickness, and Remarks could be chosen from a drop down menu.

 

I am just looking for a way to speed this process up since it seems there's room for improvement.

 

Thanks!

Link to comment
Share on other sites

  • Replies 22
  • Created
  • Last Reply

Top Posters In This Topic

  • dblclkmatt

    11

  • BIGAL

    6

  • ReMark

    4

  • steven-g

    2

Top Posters In This Topic

Posted Images

In AutoCAD that would be an attributed block and as you insert the block it would behave in the way you describe (prompt you to fill in the values). Now if you insert one block, fill in the values, then COPY the block three more times you would have to edit those values just as you are doing now. So, could this be a problem of you using the wrong technique?

Link to comment
Share on other sites

That happens occasionally where the values, with the exception of the part name, are the same. So I duplicate it and change only the item number. But I thought once the block was inserted into model space, it was it's own object and could have independent changes made as long as it was not altered inside the block editor. Is there not an ability to choose from a list in blocks?

Link to comment
Share on other sites

I'm suggesting that you insert the block each and every time you need it rather than copy (duplicate) it so that you will be prompted to fill in the values. If there are seven attributes and only one or two will be different then copy the block instead and change the values.

 

The INSERT command will provide you with a list of blocks currently available in the drawing. If the block is unavailable there are a couple of ways it can be brought into the drawing.

Link to comment
Share on other sites

It shouldn't matter if you insert or copy the block, it's attribute values remain unique, It's only by inserting the block that you will get the prompts (if it is setup correctly), but it sounds as though you are not using attributes, could you post a copy of the block it would make life much easier to see what is going on.

Link to comment
Share on other sites

That didn't sound right did it, :), but I know what I meant, if you copy a block one or more attributes can be altered independently of the original it was copied from. Besides I use coordinate values in some blocks and just by doing a straight copy, they then do have unique values without having to edit anything.

Link to comment
Share on other sites

Yes, attributes can be altered independently. I agree with you there.

 

I doubt there is anything automatic re: values appearing in the OP's block however so he is going to be out of luck there.

Link to comment
Share on other sites

Also maybe when creating the block preset the attribute variables default value, if for most they are the same value like "A36" this way its a

Link to comment
Share on other sites

Yes, attributes can be altered independently. I agree with you there.

 

I doubt there is anything automatic re: values appearing in the OP's block however so he is going to be out of luck there.

 

So I've been trying to use the attributes, but in order for it to be imported correctly into the outside program, I have to have "PART_NUMBER=" ahead of the actual number. So the problem I"m having when I enter the attribute, I have type the full line (assuming I don't misspell anything).

 

Is there a way to add a prefix to an attribute?

 

That way, it asks for the part number, I type JUST the part number, and the program automatically attaches "PART_NUMBER=" to the beginning of the number.

Link to comment
Share on other sites

Also maybe when creating the block preset the attribute variables default value, if for most they are the same value like "A36" this way its a

 

What's ?

 

Return, return, return, return?

Link to comment
Share on other sites

Last post Yep

 

If you use a lisp to insert your block then you can do anything you want with minimal input the obvious is add Part_number to a number then make it attribute value.

 

Simply look at what happens manually

Insert Blockname Pt 1 1 0 partnumb1223 material-steel weight-56 etc

 

In lisp example (command "insert" blockname pt 1 1 0 att1 att2 att3 att4) you would via lisp enter the values for att1 att2 etc adding the correct prefix then pick a point. A smarter version would pop a dialouge box with preset values and common group answers as sub diolouges.

 

Why not have a go at writing the lisp we are here to help.

Link to comment
Share on other sites

Last post Yep

 

If you use a lisp to insert your block then you can do anything you want with minimal input the obvious is add Part_number to a number then make it attribute value.

 

Simply look at what happens manually

Insert Blockname Pt 1 1 0 partnumb1223 material-steel weight-56 etc

 

In lisp example (command "insert" blockname pt 1 1 0 att1 att2 att3 att4) you would via lisp enter the values for att1 att2 etc adding the correct prefix then pick a point. A smarter version would pop a dialouge box with preset values and common group answers as sub diolouges.

 

Why not have a go at writing the lisp we are here to help.

 

(DEFUN C:BLK () 
(SETQ PN "PART_NUMBER= ")
(SETQ MT "MATERIAL= ")
(SETQ TH "THICKNESS= ")
(SETQ QT "QUANTITY= ")
(SETQ RM "REMARKS= ")
(SETQ ATT1 (GETSTRING "Part number ???"))
(SETQ ATT2 (GETSTRING "What Material ???"))
(SETQ ATT3 (GETSTRING "The THickness ???"))
(SETQ ATT4 (GETSTRING "Number of Items ???"))
(SETQ ATT5 (GETSTRING "Any Remarks ???"))
(SETQ PT (GETPOINT "Insertion point ???"))
	(COMMAND "-INSERT" "part_block" pt 1.0 1.0 0 PN MT TH QT RM))
(princ)
)

 

part_block.dwg

 

So, I can tell that I am putting more thought than necessary. There must be a more simple way that I just don't know about, but the above code with the attached block works on import and with the prompts.

 

I can't figure out how to combine the PN value to the ATT1 value when the block asks for the block's attribute value.

 

And I was actually looking for a way to do it the smart way, but I'm not so smart just yet obviously.

Link to comment
Share on other sites

To explain more what I am trying to do with the previous function, I essentially intend to combining PN and ATT1 values in a single string of text as a response to the attribute dialog box that follows after inserting the block. That way, for example, the first answer to the block insertion, it will automatically place "PART_NUMBER=" in front of whatever the response to ATT1 may be. Essentially adding a prefix to the attribute without requiring me to type PART NUMBER every time I insert a the block.

 

It seems like I can't do it during the block insertion process, so I need to combine them into a new value be prior to adding the block.

 

Something like (SETQ PN_COMBO (combinestring PN & ATT1))

Link to comment
Share on other sites

Simple use Strcat joins strings, note do not need Pn MT TH etc

 

(SETQ ATT1 (strcat "Part_number=" (GETSTRING "Part number ???")))
&
(COMMAND "-INSERT" "part_block" pt 1.0 1.0 0 ATT1 ATT2 ATT3 ATT4)

Link to comment
Share on other sites

Simple use Strcat joins strings, note do not need Pn MT TH etc

 

(SETQ ATT1 (strcat "Part_number=" (GETSTRING "Part number ???")))
&
(COMMAND "-INSERT" "part_block" pt 1.0 1.0 0 ATT1 ATT2 ATT3 ATT4)

 

Excellent, worked like a charm! I thought I was over complicating it, but I didn't know about that function. I thought the values had to be declared separate each other at first and combined later on.

 

Now I need to figure out "the smarter way" (as you put it), and have a list to choose from for the Remarks sections instead of typing in an input. I notice when I try to input "NO KERF" to the dialog, it treats the space as a return.

Link to comment
Share on other sites


(defun c:BLK () 
(setq PT (getpoint "Insertion point ??? "))
(setq ATT1 (strcat "PART_NAME=" 
	(setq *shp*
			(
   				(lambda ( input ) (if (eq "" input) *shp* input))
   				(getstring (strcat "\nShop Order ??? <" (setq *shp* (cond (*shp* ) ( "41000" ))) "> : "))
			)
	)
"-" (getstring "\nItem Number ??? ")
))

(setq ATT2 (strcat "MATERIAL=" 
	(setq *mtrl*
			(
   				(lambda ( input ) (if (eq "" input) *mtrl* input))
   				(getstring (strcat "\nMaterial ??? <" (setq *mtrl* (cond (*mtrl* ) ( "A36" ))) "> : "))
			)
	)
))

(setq ATT3 (strcat "THICKNESS=" 
	(setq *thck*
			(
   				(lambda ( input ) (if (eq "" input) *thck* input))
   				(getstring (strcat "\nThickness ??? <" (setq *thck* (cond (*thck* ) ( "1.00" ))) "> : "))
			)
	)
))

(setq ATT4 (strcat "QUANTITY=" 
	(setq *qty*
			(
   				(lambda ( input ) (if (eq "" input) *qty* input))
   				(getstring (strcat "\nQuantity ??? <" (setq *qty* (cond (*qty* ) ( "1" ))) "> : "))
			)
	)
))

(setq ATT5 (strcat "REMARKS=" (getstring "Remarks ??? ")))

(command "-insert" "part_block" PT 1.0 1.0 0 ATT1 ATT2 ATT3 ATT4 ATT5)

(setq lastEnt(entlast)) ;; I understood this to select the most recent object, so that I could burst it
(command "burst")) 

(princ)
)

 

Wasn't able to figure out how to make a proper list, but I did find a forum that showed how to hold onto the input from the previous time the command was used.

 

I also couldn't figure out how to select the block after it was inserted so that I could "Burst" it out of the block. When I export the parts out to another program, the program doesn't see the information inside the block. So ideally, I'd like it burst at the end of the function. What am I writing wrong with the selection portion? Thanks.

Link to comment
Share on other sites

Burst answer

(command "Burst" (entlast) "")
or
(command "Burst" lastent "")

 

I try to input "NO KERF"
did you try using the " as well it should look for a closing " so spaces will be accepted.
Link to comment
Share on other sites

Burst answer

(command "Burst" (entlast) "")
or
(command "Burst" lastent "")

 

did you try using the " as well it should look for a closing " so spaces will be accepted.

 

(setq ATT5 (strcat "REMARKS=" (getstring "Remarks ??? ")))

(command "-insert" "part_block" PT 1.0 1.0 0 ATT1 ATT2 ATT3 ATT4 ATT5)
(command "Burst" (entlast) ""))

(princ)
)

 

Tried both versions, it comes back:

Burst Unknown command "BURST". Press F1 for help.

 

I know burst is part of express, but it works if I key it in myself. This was the results from my trial and error before asking as well.

 

And adding quotes for my input solved the space bar issue.

Link to comment
Share on other sites

Ok express has a couple of gotchas Extrim as an example, code example below works, its probably the same problem, anyone know the command once burst is loaded ?

,

(load "Extrim")
(etrim obj pt1)

(load "BURST")
(Burst???? (entalst))
;  (burst (entlast))
; error: no function definition: BURST

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...