簡體   English   中英

當我更改attributeReference textString屬性時,我的BlockReference的位置會發生變化嗎?

[英]When I change an attributeReference textString property the position of my BlockReference changes?

我已經使用WblockCloneObjects方法將第一個文件dwg中的blockReference復制到了現有文件中。 我已經設置了這個blockReference的位置,並且效果很好。

問題是當我更改attributeReference textString屬性時,我的blockReference更改了位置,並且該屬性的值在blockReference中不可見。

這是我的代碼:

private bool SetIssueNumber(Transaction toTransaction, BlockReference deepClonedIssue, string identifier)
{
    //Get the attributeCollection
    Autodesk.AutoCAD.DatabaseServices.AttributeCollection attrCollection = deepClonedIssue.AttributeCollection;
    //Get the object
    foreach (ObjectId idAttrReference in attrCollection)
    {
        AttributeReference attributeReference =
            toTransaction.GetObject(idAttrReference, OpenMode.ForWrite) as AttributeReference;
        if (attributeReference == null)
            return false;
        if (attributeReference.Tag.Equals("ISSUENUMBER"))
        {
            attributeReference.TextString = identifier;
            return true;
        }
    }
    return false;
}

當我刪除時:

attributeReference.TextString = identifier;

blockReference出現在期望的位置,但是執行它時,我發現位置沒有改變,attribute的值也沒有出現。

不確定如何深化塊引用,但是您可能還需要變換(移動/旋轉/縮放)屬性。 這是帶有幫助文件注釋的方法。

AttributeReference.SetAttributeFromBlock方法(Matrix3d)

將blockTransform應用於屬性的幾何數據,以按照INSERT命令的操作來變換位置,大小和傾斜。 屬性的文本和實體屬性數據將保留。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM