• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

insert image in a cartiglio

  • Thread starter Thread starter mastro.alle
  • Start date Start date

mastro.alle

Guest
Bye to all,
I started from one of the examples present to create a type of custom cartilage in which the logo of my company should appear.
Does anyone have any idea how I can insert an image during the automatic creation of the cartilage?

Thank you.
 
Bye!
I simply insert->picture. . .
However, it uses not too heavy jpg otherwise the size of the .catdrawing becomes high.
if the logo is black and white you can also recreate it in a dxf and import it.

greetings
richer
 
Hi.
Perhaps I have explained badly....I know that to insert an image in a catdrawing the procedure is "insert->picture...", but I would like to know if there is a way to get this operation done automatically while creating the cart. what I miss are the lines of code to insert into the macro, since catia does not record any operation if I activate the macro recorder while manually inserting an image.

Is there any VB expert who can help me?
 
I started from one of the examples present to create a type of custom cartilage in which the logo of my company should appear.
Amazing. I've had the same problem for three weeks. but I can't help you.
I have made previously unthinkable changes to the example of an existing cartilage, interpreting the code in vb (of which I have no mastery).
the cartiglio without image works me well, but for this I lost in passages like this:
Code:
sub catcreatelogoazienza()
'----------------------------------
  'how to create the logo
'----------------------------------
  with image
      .picture = loadpicture("c:\...\...\...\....jpg")
      .stretch = true
      .left = 0
      .top = 0
      .width = me.width
      .height = me.height
  end with
'----------------------------------
  withevents imagine as image
  set imagine = cata.controls.add("vb.image", "imagine" & index_imagine)
  index_imagine = index_imagine + 1
  imagine.stretch = true

  with imagine
    .visible = true
    .left = txtleft.text
    .top = txttop.text
    .width = txtwidth.text
    .height = txtheight.text
    .picture = loadpicture("c:\...\...\...\....jpg")
  end with
end sub
... plus all calls scattered in the code, as it happens for the other sub.
Since it does not work, there are errors, perhaps conceptual, maybe even serious:confused: who knows.
I sent back to when I got some time to study a little more the vb. If I find out something, I'll write it here.Did you solve it?Saluted.
 
I would like to be able to intervene but I have no dimisticity with cads however I find interesting the topic. Hi.
 
I would like to be able to intervene but I have no dimisticity with cads however I find interesting the topic. Hi.
here the problem is programming, unfortunately, in the visual basic language.
on the cad then you go only to do the tests of insertion of the cartilage in the setting of the table, to see if it happens correctly.
 
Hello, everyone.
I suggest we leave this road... he tried my fellow programmer and after several attempts he surrendered.
I solved it my way... for various formats a0-a1-a2 etc... I created an independent catdrawing file by manually modifying the cartilage in the edit sheet background command and inserting all the pictures that I want... when I need my good drawing board I open the file and execute the command saves by name .... creating at this point a new catdrawing file with dedicated encoding for the project and changing directories !!! result??? all in the office followed this myth and also other friends .
I hope I've been helpful... Hi.
 
private const rationone=0
private const ratiowidth=1
private const ratioheight=2
dim odocument
dim osheets
dim osheet
dim oview
dim opictures


public sub catmain()

on error resume next
set odocument = catia.activedocument
if err.number <> 0 then
set odocument = catia.documents.add("drawing")
err.clear
end if
on error goto 0

set osheets = odocument.sheets
set osheet = osheets.activesheet
set oview = osheet.views.activeview
set opictures = oview.pictures

msgbox "the macro will insert a jpg file in your drawing at position x =150, y =0. the file must be in the folder c:\temp\ (which should be created before runnning the macro) and must have the name logo. modify the code if you want something else"

insertpicture "c:\temp\coe_logo.jpg", 150, 0, ratioheight, 100,25


end sub

sub insertpicture (strpath , dblanchorx, dblanchory, prratio, dblwidth, dblheight)
dim objpicture

set objpicture = opictures.add(strpath, dblanchorx, dblanchory)
formatpicture objpicture, prratio,-1 ,-1 , dblwidth, dblheight

set objpicture = nothing
end sub

public sub formatpicture(objpicture , prratio , dblanchorx, dblanchory, dblwidth , dblheight )
dim dblscalar

if dblanchorx >= 0 then objpicture.x = dblanchorx
if dblanchory >= 0 then objpicture.y = dblanchory

if prratio = ratiowidth then
'picture scaled by width with fixed ratio
if dblwidth > 0 then
dblscalar = objpicture.width / dblwidth
objpicture.height = objpicture.height / dblscalar
objpicture.width = dblwidth
end if
elseif prratio = ratioheight then
'picture scaled by height with fixed ratio
if dblheight > 0 then
dblscalar = objpicture.height / dblheight
objpicture.width = objpicture.width / dblscalar
objpicture.height = dblheight
end if
else
'picture scaled by width & height
if dblwidth > 0 then objpicture.width = dblwidth
if dblheight > 0 then objpicture.height = dblheight
end if

end sub


ps es un catscript
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top