piratabobo
Guest
Hello to all I have a problem that I cannot solve, I create a block with its attribute and insert it in the drawing, the block consists of a circle and attributes, in the insertion of the block I would like to insert the circle in a coordinate and the attribute in another coordinate, I do not know if the thing can be feasible, I hope someone can give me a straight, this is the code I use to create and insert the block:
'create the ethical layer if there is no
for i = 0 to thisdrawing.layers.count - 1
name = thisdrawing.layers.item(i).name
if name = "etichet" then exit for
next i
if name < etichet then
set object = thisdrawing.layers.add("etichet")
end if
lazy = 4 * atn(1)
ang = (pigreco * cdbl(txt_ang.text) / 180
type = "data"
'It inserts block image
items() = split(cbo_blocco.text, ")
cod = (items(0))
'It inserts the block
pnt = thisdrawing.utility.getpoint
x = pnt(0)
y = pnt(1)
'checks the existence of the block in the design
for i = 0 to thisdrawing.blocks.count - 1
name = thisdrawing.blocks.item(i).name
if name = type then exit for
next i
if name <
p1(0) = 0#: p1(1) = 0#: p1(2) = 0#
set oblock = thisdrawing.blocks.add(p1, type)
'creates the block insert highlighting circle
radius = 1.2
set entity = oblock.addcircle(p1, radius)
entity.color = acred
height = 3.76
mode = acattributemonormal
value = "
p2(0) = 3.75: p2(1) = 3.5: p2(2) = 0
tag = "code": prompt = ""
set attrib = oblock.addattribute(height, mode, prompt, p2, tag, value)
attrib.layer = "etichet"
attrib.color = acwhite
mode = acattributemodeinvisible
value = "
tag = "name": prompt = ""
set attrib = oblock.addattribute(height, mode, prompt, p2, tag, value)
attrib.layer = "etichet"
attrib.color = acwhite
mode = acattributemodeinvisible
value = "
tag = "description": prompt = ""
set attrib = oblock.addattribute(height, mode, prompt, p2, tag, value)
attrib.layer = "etichet"
attrib.color = acwhite
p2(0) = x : p2(1) = y : p2(2) = 0
set obkref = thisdrawing.modelspace. insertblock(p2, type, 1, 1, 1, 0)
obkref.layer = "etichet"
♪
call label
p2(0) = x : p2(1) = y : p2(2) = 0
set obkref = thisdrawing.modelspace. insertblock(p2, type, 1, 1, 1, 0)
obkref.layer = "etichet"
end if
pnt = obkref.getattributes
for i = lbound(pnt) to ubound(pnt)
tag = pnt(s).tagstring
select houses tag
houses is = "code"
pnt(i).textstring = lbl_codifica.caption
houses is = "name"
pnt(i).textstring = lbl_nome.caption
houses is = "description"
pnt(i).textstring = lbl_description.caption
end select
next i
pnttot(0) = x: pnttot(1) = y: pnttot(2) = 0
set obkref = thisdrawing.modelspace. insertblock(pnttot, path & "blocchi\" & cod & ".dwg", 1, 1, 1, ang)
'create the ethical layer if there is no
for i = 0 to thisdrawing.layers.count - 1
name = thisdrawing.layers.item(i).name
if name = "etichet" then exit for
next i
if name < etichet then
set object = thisdrawing.layers.add("etichet")
end if
lazy = 4 * atn(1)
ang = (pigreco * cdbl(txt_ang.text) / 180
type = "data"
'It inserts block image
items() = split(cbo_blocco.text, ")
cod = (items(0))
'It inserts the block
pnt = thisdrawing.utility.getpoint
x = pnt(0)
y = pnt(1)
'checks the existence of the block in the design
for i = 0 to thisdrawing.blocks.count - 1
name = thisdrawing.blocks.item(i).name
if name = type then exit for
next i
if name <
p1(0) = 0#: p1(1) = 0#: p1(2) = 0#
set oblock = thisdrawing.blocks.add(p1, type)
'creates the block insert highlighting circle
radius = 1.2
set entity = oblock.addcircle(p1, radius)
entity.color = acred
height = 3.76
mode = acattributemonormal
value = "
p2(0) = 3.75: p2(1) = 3.5: p2(2) = 0
tag = "code": prompt = ""
set attrib = oblock.addattribute(height, mode, prompt, p2, tag, value)
attrib.layer = "etichet"
attrib.color = acwhite
mode = acattributemodeinvisible
value = "
tag = "name": prompt = ""
set attrib = oblock.addattribute(height, mode, prompt, p2, tag, value)
attrib.layer = "etichet"
attrib.color = acwhite
mode = acattributemodeinvisible
value = "
tag = "description": prompt = ""
set attrib = oblock.addattribute(height, mode, prompt, p2, tag, value)
attrib.layer = "etichet"
attrib.color = acwhite
p2(0) = x : p2(1) = y : p2(2) = 0
set obkref = thisdrawing.modelspace. insertblock(p2, type, 1, 1, 1, 0)
obkref.layer = "etichet"
♪
call label
p2(0) = x : p2(1) = y : p2(2) = 0
set obkref = thisdrawing.modelspace. insertblock(p2, type, 1, 1, 1, 0)
obkref.layer = "etichet"
end if
pnt = obkref.getattributes
for i = lbound(pnt) to ubound(pnt)
tag = pnt(s).tagstring
select houses tag
houses is = "code"
pnt(i).textstring = lbl_codifica.caption
houses is = "name"
pnt(i).textstring = lbl_nome.caption
houses is = "description"
pnt(i).textstring = lbl_description.caption
end select
next i
pnttot(0) = x: pnttot(1) = y: pnttot(2) = 0
set obkref = thisdrawing.modelspace. insertblock(pnttot, path & "blocchi\" & cod & ".dwg", 1, 1, 1, ang)