소스 정보
- 저장소
- hebackus/c3d-api-plugin
- 최근 소스 활동
- 2026년 4월 9일 01:53
- 감지된 SKILL.md 언어
- 영어
- 스타
- 3
- 포크
- 0
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/hebackus/c3d-api-plugin --skill acad-blocks명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
| name | acad-blocks |
| description | Block definitions, references, attributes, dynamic block properties, exploding |
Use this skill when creating block definitions, inserting block references, working with attributes, or reading dynamic block properties.
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTable bt = (BlockTable)tr.GetObject(
db.BlockTableId, OpenMode.ForWrite);
// Create a new block definition
BlockTableRecord blockDef = new BlockTableRecord();
blockDef.Name = "MyBlock";
blockDef.Origin = new Point3d(0, 0, 0);
blockDef.Comments = "A custom block";
blockDef.Units = UnitsValue.Millimeters;
blockDef.Explodable = true;
ObjectId blockId = bt.Add(blockDef);
tr.AddNewlyCreatedDBObject(blockDef, true);
// Add entities to the block definition
Line line = new Line(new Point3d(0, 0, 0), new Point3d(10, 10, 0));
blockDef.AppendEntity(line);
tr.AddNewlyCreatedDBObject(line, true);
Circle circle = new Circle(new Point3d(5, 5, 0), Vector3d.ZAxis, 3.0);
blockDef.AppendEntity(circle);
tr.AddNewlyCreatedDBObject(circle, true);
tr.Commit();
}
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(
blockId, OpenMode.ForRead);
foreach (ObjectId entId in btr)
{
Entity ent = (Entity)tr.GetObject(entId, OpenMode.ForRead);
ed.WriteMessage("Entity: {0}\n", ent.GetType().Name);
}
BlockTableRecord space = (BlockTableRecord)tr.GetObject(
db.CurrentSpaceId, OpenMode.ForWrite);
BlockReference blockRef = new BlockReference(
new Point3d(100, 200, 0), // insertion point
blockDefId); // BlockTableRecord ObjectId
blockRef.Rotation = 0.0; // rotation in radians
blockRef.ScaleFactors = new Scale3d(1.0); // uniform scale
blockRef.Normal = Vector3d.ZAxis;
space.AppendEntity(blockRef);
tr.AddNewlyCreatedDBObject(blockRef, true);
AttributeDefinition attDef = new AttributeDefinition(
new Point3d(5, -5, 0), // position
"Default Value", // default value
"TAG_NAME", // tag
"Enter value:", // prompt
textStyleId); // text style
attDef.Height = 2.5;
attDef.Invisible = false;
attDef.Constant = false;
attDef.Verifiable = false;
attDef.Preset = false;
attDef.LockPositionInBlock = false;
// MText attribute definition
attDef.IsMTextAttributeDefinition = true;
MText mtext = new MText();
mtext.Contents = "Multi\\Pline";
attDef.MTextAttributeDefinition = mtext;
attDef.UpdateMTextAttributeDefinition();
blockDef.AppendEntity(attDef);
tr.AddNewlyCreatedDBObject(attDef, true);
// After inserting a BlockReference, add attribute references
BlockTableRecord blockDef = (BlockTableRecord)tr.GetObject(
blockRef.BlockTableRecord, OpenMode.ForRead);
foreach (ObjectId entId in blockDef)
{
AttributeDefinition attDef = tr.GetObject(entId, OpenMode.ForRead)
as AttributeDefinition;
if (attDef == null || attDef.Constant) continue;
AttributeReference attRef = new AttributeReference();
attRef.SetAttributeFromBlock(attDef, blockRef.BlockTransform);
// Position does NOT auto-update from SetAttributeFromBlock — must set manually
attRef.Position = attDef.Position.TransformBy(blockRef.BlockTransform);
attRef.TextString = attDef.TextString; // or set custom value
blockRef.AttributeCollection.AppendAttribute(attRef);
tr.AddNewlyCreatedDBObject(attRef, true);
}
foreach (ObjectId attId in blockRef.AttributeCollection)
{
AttributeReference attRef = (AttributeReference)tr.GetObject(
attId, OpenMode.ForRead);
ed.WriteMessage("Tag: {0}, Value: {1}\n",
attRef.Tag, attRef.TextString);
}
foreach (ObjectId attId in blockRef.AttributeCollection)
{
AttributeReference attRef = (AttributeReference)tr.GetObject(
attId, OpenMode.ForWrite);
if (attRef.Tag == "TITLE")
attRef.TextString = "New Title";
}
if (blockRef.IsDynamicBlock)
{
// Get the original (non-anonymous) block name
BlockTableRecord dynBtr = (BlockTableRecord)tr.GetObject(
blockRef.DynamicBlockTableRecord, OpenMode.ForRead);
string originalName = dynBtr.Name;
// Read and write dynamic properties
DynamicBlockReferencePropertyCollection props =
blockRef.DynamicBlockReferencePropertyCollection;
foreach (DynamicBlockReferenceProperty prop in props)
{
string name = prop.PropertyName;
object val = prop.Value;
bool readOnly = prop.ReadOnly;
bool show = prop.Show;
bool visible = prop.VisibleInCurrentVisibilityState;
short typeCode = prop.PropertyTypeCode;
DynamicBlockReferencePropertyUnitsType units = prop.UnitsType;
string desc = prop.Description;
// Get allowed values (for constrained properties)
object[] allowedValues = prop.GetAllowedValues();
ed.WriteMessage(" {0} = {1} (type: {2})\n", name, val, typeCode);
}
// Set a dynamic property value
foreach (DynamicBlockReferenceProperty prop in props)
{
if (prop.PropertyName == "Distance" && !prop.ReadOnly)
{
prop.Value = 500.0; // set new value
break;
}
}
}
BlockReference.Name returns the anonymous block name for dynamic blocks (e.g., "*U42"); use DynamicBlockTableRecord to get the original nameAppendEntity and AddNewlyCreatedDBObject on the block ref firstSetAttributeFromBlock(attDef, blockRef.BlockTransform) is essential - it positions the attribute correctly based on the block's transform; without it, attributes appear at the wrong locationConstant attributes have fixed values and are NOT included in AttributeCollection on the block referenceBlockTableRecord.ModelSpace and PaperSpace are string constants for the standard space names, not references to the blocks themselvesExplodeToOwnerSpace() adds exploded entities to the parent and erases the block reference; cannot be undone without transaction rollbackConvertToStaticBlock() on a dynamic block reference permanently freezes the current state - the reference can no longer access dynamic propertiesValue is typed as object - cast to the appropriate type (double, string, Point3d, etc.) based on PropertyTypeCodeGetBlockReferenceIds(true, false) returns only direct references; use (false, true) to include nested references and force validity checksacad-layers — block references and entities within blocks inherit layer propertiesacad-editor-input — selecting block references with GetEntity or selection filters (DxfCode.Start "INSERT")acad-mleaders — block references as MLeader block contentSOC 직업 분류 기준