« Last post by Alien on Today at 04:49:30 am »
I have a folder of parts i need to add to my parts catalog. Anyone know how I can do this? Simply copying the folder into the directory doesn't appear to be working.
- (defun c:test (/ ent dist2 dist obj kwrd)
- (vl-load-com) ;<-good!
- nil ;<- testing for nil is unneeded, use LISP's return values directly
- (princ "\nThat was not a line. Please select again: ") ;<- what if I pick a circle?
- (initget (+ 1 2 4 64)) ;<- use of the Z-blocker was nice
- (initget (+ 2 4) "Yes No") ;<- bits 2 and 4 server no purpose in (getkword)
- (if (/= kwrd "No") ;<- this statement is unneeded, see below
- (setq kwrd "Yes")
- (vla-offset obj dist)
- (vla-offset obj (* dist2 -1))
- (vla-erase obj)
I've built an AutoCAD Plugin that replaces some DBText and MText Objects with an attributed block. My problem: Some of the MText have their alignment set to "Top left" and some have it set to "Bottom left".
The block that replaces the MText is designed so that it perfectly matches the text position if it was set to "Bottom Left" - since the majority of MText objects is drawn this way; I'd like to change all the MText alignments to "Bottom Left", so I can use the same block for all MText objects.
When I change the alignment in AutoCAD, the actual text position stays the same - the alignment property is set to a new value and the text is moved to the new position, so that the position of the letters stays the same <- That's what I'm trying to accomplish
Can someone get me started on how to do this? I'm not sure how to tackle this one... Below I have attached a small test command to change the .Attachment of the MText's.Code: [Select]
public void MTextJustificationTest()
Database db = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument.Database;
Editor ed = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument.Editor;
Point3d startPos = new Point3d();
using (Transaction tr = db.TransactionManager.StartTransaction())
TypedValue filterDxf = new TypedValue
SelectionFilter selectionFilter = new SelectionFilter(filterDxf);
PromptSelectionResult psr = ed.SelectAll(selectionFilter);
SelectionSet selectionSet = psr.Value;
foreach (var objId in psr.Value.GetObjectIds())
MText mText = tr.GetObject(objId, OpenMode.ForWrite) as MText;
if (mText.Attachment != AttachmentPoint.BottomLeft)
startPos = mText.Location;
// How to get the _real_ text position?
mText.Attachment = AttachmentPoint.BottomLeft;
How did you do it ??