Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PLine - Area - Attribute

14 REPLIES 14
SOLVED
Reply
Message 1 of 15
irishrandy26
976 Views, 14 Replies

PLine - Area - Attribute

I am trying to create a macro or possibly a lispertine to draw a PLine then gather the area of the previously created PLine and then insert a block and insert the information into the block. I have gotten this done already but now I am trying to push this further. I am more curious to know if I can insert a field of a selected area into a block that way if I adjust the PLine it will automatically update. Here is the macro I have come up with (^C^CAREA;O;\attdia;0;_-insert;rname;\1;1;0;$M=$(rtos,$(/,$(getvar,AREA),144),2,0) "SQ FT";\\\attdia;1) that will let you select the already created PLine, insert the block and then insert the information into the block. But like I said I want the area to update automatically if the size changes.

 

Can anyone help me with this? Is this possible to take any further?

14 REPLIES 14
Message 2 of 15

Lee Macs areas to field lisp can do this.  If you change the polygons size a refresh will update the associated field.

Message 3 of 15

The page you posted isn't working. Can you just post the link?

Message 4 of 15

Oh, I just typed it into Google and I figured out it is an external program. I am looking for a way to not have to rely on any external programs... Any other advice?

Message 5 of 15
~Opie
in reply to: irishrandy26

The problem is to place all of that into a macro can be quite lengthy and requires more than a simple command macro can provide. To generate the necessary text for a field, which can update, requires an ObjectID. There is no simple native command in AutoCAD which provides that information. If using Visual LISP, you then need to also know if you are running on a 64 bit or 32 bit system as it takes two different methods to extract the correct ObjectID to place into the field.

An external program would be your best bet.
Message 6 of 15
irishrandy26
in reply to: ~Opie

Ok, so basically there is a way but it is hard to do? I am not super good at Lispertine's so I guess I will have to go with using the external program.

 

I was only trying to do this solely in AutoCAD because I work for a big firm and if I could update everyone's autocad at the same that that would be best for me. Specially if something changes. I don't want to have to go to each persons computer and download this software.

Message 7 of 15
paullimapa
in reply to: irishrandy26

Try my free AOL.lsp app on the Exchange:

http://apps.exchange.autodesk.com/ACD/en/Detail/Index?id=appstore.exchange.autodesk.com%3aareaobject...

 

It won't draw the PLINE but it'll Insert a Block with Attribute using a Field linking the Pline or Hatch Area.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 8 of 15
irishrandy26
in reply to: paullimapa

I know, I have come across your app a few times. I am just really trying to hold out until I can confirm that I can not make this lispertine or macro, preferably a macro.

Message 9 of 15
paullimapa
in reply to: irishrandy26

As ~Opie posted already, this can only be done with lisp and not a macro. 

As for working in a big firm, just place the lisp file in a common location on the network.

Have everyone's AutoCAD Appload Startup Suite Contents point to the location where that lisp app. is saved

Then everytime AutoCAD starts, it'll load the lisp app automatically.

When the lisp app needs to be updated, just overwrite the file on the network location.

You are set to go.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 10 of 15
~Opie
in reply to: paullimapa

I would advise against the Appload Startup Suite. This would require you to visit each computer to adjust the Appload Startup Suite. You would want to look into providing a networked "ACADDOC.LSP" file. The location for this file would be a location specified in the Support File Search Path (SFSP) found on the Files tab of your Options dialog. This path may also be specified in the ACAD environment variable.

If your computers do not currently have a network path listed in the SFSP, you will need to either manually add it at each computer, or provide a script to make this change, or may check with your IT staff to make this change.

With a large firm, you may already have this path available.
Message 11 of 15
irishrandy26
in reply to: ~Opie

So once again I really appreciate everyone input but I am really wanting to figure out this lisp to get the field in a dynamic block instead of having to run an external program. What I am trying to figure out is how the field command generates it's commands.

Message 12 of 15
irishrandy26
in reply to: irishrandy26

I have noticed that the object ID is the oly thing that changes...

 

These are two different codes I get from selecting certain closed PLines.

 

Area - 1

%<\AcObjProp Object(%<\_ObjId 8796087839344>%).Area \f "%pr0%lu2%ct4%qf1 SQ. FT.">%

 

Area – 2

%<\AcObjProp Object(%<\_ObjId 8796087838880>%).Area \f "%pr0%lu2%ct4%qf1 SQ. FT.">%

 

Message 13 of 15
~Opie
in reply to: irishrandy26

To do that, you would need to create your dynamic block. Then create a new
closed polyline. After those two objects are created, create the field
within the attribute of the block which references the polyline. Now that
those two objects are created, combine them into a new block.

To use this new "container" block, you would need to wblock it out first.
Then make sure to explode it when inserting it into your drawings. You
would then nees to manipulate the polyline as needed.

Of course as with most things in AutoCAD, this isn't the only solution to
your problem. It also isn't very easy. But it is a solution without an
external program requirement.
Message 14 of 15
irishrandy26
in reply to: ~Opie

Opie -

Are you saying that I would have to create a new block every time I wanted to do this? I already have a designated block for this...

Message 15 of 15
irishrandy26
in reply to: irishrandy26

Actually I just read your response again and I think I understand what you are saying... I am going to try it right now.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost