PDA

View Full Version : Lisp? Whatsp thatsp?



roberts.matthew.h
2009-03-24, 08:31 PM
In all seriousness, I've decided to poke around here for some help.

I'm trying to make a dynamic block (or lisp, if it must be) for inserting coordinates on plan drawings for my company. I've done a loooooooot of looking around, and haven't really been able to find much useful information to accomplish my goal. After some direction from the Autodesk forums, I figured I'd come here and see what, if anything, could be suggested. Here's my procedural process list (someone said I should make one) on how I imagine it would work. Attached is examples of the different "blocks" I would need to make, so far in as just the text & CenterLine symbol. It's just to show what our standards look like for labeling centerlines, as well as buildings, fenceposts, and other such things.

Thanks for your help in advance!!!

1) User runs Lisp or says Insert block.
2) User picks point in paper space, on top of viewport, for example, the centerline of a westwardly running pipe.
3) Point goes "into" viewport and ID's that point, based off an origin of 0,0,0.
4) Point returns an X & Y location to the block.
5) In the block, the N. text populates with the Y location, in a format according to standard:
(If Y>0, N. x+xx'-x", if Y0, E. x+xx'-x", if X<0, W. x+xx'-x")
7) Block completes insertion.

ccowgill
2009-03-25, 12:08 PM
I would think a simple block with fields that display the x and y coord. however, I dont know how to get it to read thru a viewport.

irneb
2009-03-25, 12:15 PM
You can do this in one of 4 ways (3 of them don't require LISP unless you want to make it slightly simpler):

Create a normal attributed block, insert the block once & EATTEDIT it. Place a field in the attribute where you want its coordinates to display (in Field Dialog: Field category=Objects; Field names=Object; click button next to Object type, pick the block you just inserted, Property=Position, uncheck the Z coordinate, OK out twice). Now you can copy that block to new positions, then simply do a REGEN to update to each coordinate.
Create a dynamic block with an XY parameter from the block's origin (0,0,0) point at an arbitrary distance for X&Y (you need to be inside BEDIT). Change the XYparam's number of grips to 1. Move the linework / text / attrib / etc. central to the param's node. Create an ATTDEF, in its default field click the button, again in Field dialog, select Objects, then BlockPlaceholder, then in Block reference property list, pick the X Distance, OK, add comma, click again and follow same steps to add Y Distance. Cloce BEDIT mode & save changes. Now when you insert the block at 0,0 its default attrib text would be the parameter distance. So move the parameter (click & drag) to the point you want it to be. Again do a regen. Move or streatch won't affect the block ... you have to shange its parameter using Properties Palette or click & drag the hot-spot.
Place 2 ordinate dimensions (DIMORDINATE) on the same point with their text positions: 1 for X the other for Y. You can stretch the dims & they'll update automatically, don't move them as one of their points is placed on the origin ... with move you move them off the origin, thus no change to displayed value.
Create a lisp to fill in Attributes to the selected point. It should ask the user for the insertion point, then do an insert of the block at that point, then obtain a reference to the block it just inserted, then obtain a reference of the attribute where the data should be stored, then change its text value to display the coordinates from the point picked by the user. Unfortunately this won't update automatically if the block is moved \ streatched.In all of the above, the problem comes in from picking the point in PS. Basically you'll have to place some entity (e.g. POINT) in PS. Then use CHSPACE to move it to MS (don't know how you'll be able to get hold of what viewport to use through LISP). Then insert / copy / change param / stretch to that point. Then delete the temporary point.

lpseifert
2009-03-25, 03:37 PM
Try this to transfer from PS coords to MS coords.


(defun test ()
(command "._pspace")
(setq pt-ps (getpoint "Pick point: "))
(command "._mspace")
(setq pt-ms (trans (trans pt-ps 3 2) 2 1))
)

roberts.matthew.h
2009-03-25, 04:56 PM
Ipseifert,

That seems like great code, but I'm not sure what I'm supposed to do with it. Are you suggesting I add it on to irneb's option #4? And even that, I'm not sure what to do. :(