Hello all,
I'm currently working on an AutoLISP script for creating labels using multiple fields for features that are visible within a layer. I will preface that I'm not super familiar with AutoCAD or AutoLISP, I'm curious to see if anyone has any experience or ideas for the following questions.
The script currently loops through a esri_featurelayer_select and uses esri_attributes_get on each entity in the layer. Then, it puts some of the attributes into independent variables to be used for mtext/mleaders. I've got the script is looping and pulling the attributes I need correctly into variables and are showing up in princ statements.
I'm curious if there is anyway that I can get the geometry of these features using these commands? Can the EntityHandle be used to get these attributes? I'm hoping that the geometry can then be used as inputs to a mtext or mleader commands along with the attributes.
Additionally, is there a way that users can select features in the model space and only use those features as input for the esri_attributes_get?
Happy to share my current script and to answer any questions.
Thanks!
Hi! It's great that you're looking into AutoLISP it's a good tool for customizing ArcGIS for AutoCAD. You're on the right track, and I would use those exact methods for what you're trying to accomplish.
If it's helpful, we recently published an AutoLISP sample that does something similar. It might give you some inspiration, so feel free to grab it and modify it as needed:
AutoLISP Label From Multiple Fields Sample
For the MLeader question, you can retrieve the geometric properties using the handle. You'll first need to convert the handle to an entity name using the AutoLISP handent method:
Once you have the entity name, you can use entget to access the entity's DXF properties:
With the entity name and DXF properties from entget, creating an MLeader should be fairly straightforward. You'll just need to add some logic to your script to calculate the placement and position the MLeader where you want it.