chiimayred Posted August 29, 2013 Posted August 29, 2013 Hey all, I am slowly getting the hang of writing AutoLISP and I've really appreciated everyone's input so far. I've been able to create a few lisps already that have helped out my workflow a lot! For my next lisp I am a little over my head. I'm looking to create a lisp to add the length property of my blocks together for each block name. We have a block library where we can change the length of the block and we need these lengths for a Material Take Off. Here's a breakdown of what I want the routine to be able to do: -Look for dynamic blocks in a selection -Find the lengths property for the blocks -Add the lengths together for respective blocks -Generate a report with lengths of each present block Normally I would have an attempted code for this, but I really have no idea where/how to start. Any help is most appreciated! Quote
irneb Posted August 30, 2013 Posted August 30, 2013 Look into my code for blocks: http://sourceforge.net/p/caddons/code/67/tree/Blocks/BlockData.LSP The last 2 defuns work on a block reference and extracts/sets a particular parameter. They use the other defuns as helpers, so you'll need to look at how those work too. From this you can step through a selection set of the blocks one at a time. Then if you know the param's name (or it's index) you can simply run my code on that in turn. Quote
Lee Mac Posted August 30, 2013 Posted August 30, 2013 This set of functions may also be of help. Quote
chiimayred Posted October 9, 2013 Author Posted October 9, 2013 Hey guys, Been busy for the last little bit so no progress has been made yet. Been thinking about this one more and I think I have a slightly different approach but I still need some guidance... So when I list the properties of the block in question it shows up like this: BLOCK REFERENCE Layer: "0" Space: Model space Handle = 56c Block Name: "16 NPS PIPE" Anonymous Name: "*U7" at point, X=2294.5575 Y=1474.8554 Z= 0.0000 X scale factor: 1.0000 Y scale factor: 1.0000 rotation angle: 0 Z scale factor: 1.0000 InsUnits: Meters Unit conversion: 1000.0000 Scale uniformly: No Allow exploding: Yes [b]Pipe Length: 1000.0000[/b] Visibility1: Straight Pipe How do I extract the pipe length information from the block? Quote
chiimayred Posted October 9, 2013 Author Posted October 9, 2013 After much searching I found out the DATAEXTRACTION command does exactly what I am looking for... thanks for your help guys! Quote
Lee Mac Posted October 9, 2013 Posted October 9, 2013 No worries - glad you found a solution! Thank you for reporting back Quote
Recommended Posts
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.