Dim?ppr?As?PromptPointResult?=?ed.GetPoint("請(qǐng)選擇插入點(diǎn):")
創(chuàng)新互聯(lián)公司技術(shù)團(tuán)隊(duì)十年來致力于為客戶提供成都做網(wǎng)站、網(wǎng)站建設(shè)、品牌網(wǎng)站制作、成都全網(wǎng)營銷推廣、搜索引擎SEO優(yōu)化等服務(wù)。經(jīng)過多年發(fā)展,公司擁有經(jīng)驗(yàn)豐富的技術(shù)團(tuán)隊(duì),先后服務(wù)、推廣了上千家網(wǎng)站,包括各類中小企業(yè)、企事單位、高校等機(jī)構(gòu)單位。
Dim?pt?As?Point3d?=?ppr.Value
utility.WriteToEditor(pt.ToString())
Dim?pidBlock?As?New?PIDBlock()
'自己定義的圖塊類,保存圖塊的路徑和名稱?
pidBlock.Name?=?"sample"
pidBlock.Path?=?blockPath??"b_sample.dwg"
Using?blkDb?As?New?Database(False,?True)
'read?drawing?
blkDb.ReadDwgFile(pidBlock.Path,?System.IO.FileShare.Read,?True,?Nothing)
blkDb.CloseInput(True)
Using?docLock?As?DocumentLock?=?doc.LockDocument()
'多文檔要先這樣,否則報(bào)至命錯(cuò)誤?
Using?t?As?Transaction?=?doc.TransactionManager.StartTransaction()
'insert?it?as?a?new?block?
Dim?idBTR?As?ObjectId?=?doc.Database.Insert(pidBlock.Name,?blkDb,?False)
'create?a?ref?to?the?block?
Dim?bt?As?BlockTable?=?DirectCast(t.GetObject(doc.Database.BlockTableId,?OpenMode.ForRead),?BlockTable)
Dim?btr?As?BlockTableRecord?=?DirectCast(t.GetObject(bt(BlockTableRecord.ModelSpace),?OpenMode.ForWrite),?BlockTableRecord)
Using?bref?As?New?BlockReference(pt,?idBTR)
btr.AppendEntity(bref)
t.AddNewlyCreatedDBObject(bref,?True)
End?Using
t.Commit()
End?Using
End?Using
End?Using
你去查查書吧,書上挺詳細(xì)的,在這說不好說,你先在項(xiàng)目里引用。然后 Dim acadapp As AcadApplication Dim acaddoc As AcadDocument On Error Resume Next AcadApp = GetObject(, "AutoCAD.Application") If Err.Number Then Err.Clear() AcadApp = CreateObject("AutoCAD.Application") If Err.Number Then MsgBox("不能運(yùn)行AutoCAD,請(qǐng)檢查是否安裝了AutoCAD") Exit Sub End If End If AcadApp.Visible = True '界面可視
你是要操作cad文件?網(wǎng)上有操作dxf或dwg格式的代碼,你看看dxf的格式吧,是明碼的。
簡(jiǎn)單的點(diǎn)線這些好實(shí)現(xiàn),但要尺寸標(biāo)注或其它的就要麻煩些